use cache logic similar to angular core
fixes #16
Merge pull request #96 from just-boris/master

Use cache logic similar to angular core