moved cache handling to database service added errors checks to cache creation added empty checks to query builder