added query caching to activerecord with automatic cache expiration