refactor to use db cache