keep cache consistent with real database state
Merge pull request #2653 from mattpotts/patch-3

keep cache consistent with real database state