views:

117

answers:

4

I would need to implement cache, which would need to perform SQL queries and cache results. So, I would love to read something about best practices of doing that; how do properly, staling cache results, checking, etc. Particularly, I would probably benefit from learning how Hibernate is doing that? Or some other good players :-)

A: 

Check this article by MSFT

Hamish Grubijan
A: 

One approach in the Java world is to use the OpenSymphony Cache. This is a distributed cache (like memcached) that lets you store any Java objects and set expiration policies.

If you use iBatis as your Java persistence manager, you can leverage its integration with OSCache. The Hibernate ORM also has an OSCache integration.

Jim Ferrans
A: 

This is a very good guide published by microsoft it consist of all good practices not limited to cache App Arch Guide 2.0

Harryboy
A: 

The best practice is to not cache database queries, but things you do with database queries. That is, you do a database query because you want an object that is represented by the data the query gives you. That's what you should cache.

Hibernate does some of this, and you can of course mix hibernate and memcached to get the benefits of memcached.

Dustin