Max duration for Cached items

The database was growing too large.
Added a max duration to keep the cached items in database.