Adds cache functions to database