move caching system to db layer