I am coding a web application in Java and have used postgres for now as db. Now i intend to use a cahing solution (memcache/redis) and want to experiment with other databases. How should i design my classes?(design patterns)? Example - Twitter. When i load my profile, cache can help speed up and may also be empty so i might need to go to say postgres. Then there will be threads running to ensure consistency across all data stores(chache,db1,db2). Http request should be non-blocking for de-normalized database design.

2 Answers
2

They need little custom code, and most problems are already solved. Because they build on JDBC layer, you can switch RDBMS in the background with the only modifications in JDBC config (of course only if you use standard SQL)