Nearly working cache in DB