implement DB cache