Expert |
|
Joined: Wed Apr 11, 2007 11:39 am Posts: 735 Location: Montreal, QC
|
Using a cache is usually depends on your use cases. Caching everything is not necessarily a good idea. Caching static data like list of countries is usually an improvement but if you don't have much database hit then you will not benefit much from this either. Mutable entities are usually the trouble here since hibernate per se, for obvious reasons, does not check database to see if there is a newer version of data it is caching. Therefore, then the programmer should always think up front for how long an object should be cached. For example, if you are caching business rules which can be edited then you should ask your business analysts how fast edited rules should come into the live system. If immediately then you can not cache those objects or you can cache them for short periods like 1 minute. This is kind of short term caching is only useful if again you have a high database hit rate. Remember these days databases have a good cache themselves so on a low hit rate the database cache is fairly enough.
I hope this helps.
Farzad-
|
|