Adding TTL and cache expiration
Changes for caching logic.
Merge pull request #575 from Notsew/master

Adding TTL and cache expiration