I recommend before you start reading this blog please go through our blog on Web Caching
Data Caching
Data caching is the most flexible type of caching but forces the developers to take specific additional steps in the code to implement it. The basic principle of data caching is that one adds items that are expensive to create to build in collection object called Data Cache. Data Cache is an object works globally available to all requests from all clients in the application. But it has three key differences.
Its thread safe- means we don’t need to explicitly lock or unlock the Cache object before adding or removing an item. However the object in the Cache will still need to be threading safe themselves.
Items in the cache objects are removed automatically- the expired items will (or should) remove from the cache on time to time. If one of the objects or files it depends on changes, or if the server becomes low on memory.
Cache items support dependencies- The cached objects can link to a file, a database table, or another type resource. If this resource changes, the cached objects automatically get invalid and released.
The two-step approach (the one that creates the data object need and another that manage cache) is a common, tim
e-tested design. It’s always a good strategy to ensure that you deal with the cache consistently.
Closing note – A high performance thought!
The most performance critical area in web application is the data layer. But many developers don’t realize that you can dramatically reduce the burden on database and increase the scalability of all web application with just a little bit caching code.
However, with any performance-optimization strategy, the best way to measure the value of a change is to perform stress testing and profiling. Without this step, we might spend a great deal of time perfecting code that will achieve only a minor improvement in performance or scalability, at the expense of more effective changes.
Related Posts
- No related posts found





Pingback: Caching with dependencies | Data Caching
Pingback: Benefits of web caching - Software Associates