fixes type
move caching system to db layer