i just finished implementing a similar pattern: atomic-cache (cache+eventually consistent modifications) and while it's debatable whether the pattern belongs in your "database" layer or "app" layer, you certainly do need this pattern somewhere.
For me, my orm layer is in my app, and my database is just google datastore. I have ideas for eventually writing a db caching layer as you suggest but it's rather a lot more complexity beyond the "get it working and move on" principle.
Re:Cloud Design Patterns
by alooPotato on Thursday March 10, 2016 @03:54PM
(#11262216)
Are you using something like Objectify with the google datastore?
Better to treat caching as part of your overall database infrastructure. If caching "hot" data is really important for your app, make sure your data layer supports read-through and write-through caching. Or use the "CQRS" Pattern and read from a different source than your writes (allowing your writes to transparently apply whatever underlying caching strategy you need to support the reads).
The MSDN article on CQRS actually has some good advice on combining it with Materialized Views and handling consistency issues. Worth reading if you're interested in solving your caching problems.