This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Always we talk about caching the data, fetched from the database. Suppose an user retrieves set of records matching his search criteria, if we cache the data, we can use the cache data provided, the same user or another user fires a same search criteria.So unless iam not sure of same search criteria, its of waste for me to cache the data. I just want to know whether my understanding is correct or wrong. If this "understanding is wrong" can any one please provide explaination links to caching. Hari
Originally posted by Hari babu: ...So unless iam not sure of same search criteria, its of waste for me to cache the data.
Wait. Even if search criteria is the same, can't the results be different? What if the underlying data has been updated since the first search by another user? Entity beans provides pessimistic caching and if you are using them, you are already making use of caching. If you like to design your own caching framework, consider some of the challenges - The instance you cache any data, you accept the risk of working with "stale" data. A cache that cannot be updated is useless. But the question is, how frequently should you update the cache? And should you cache mostly dynamic data, or mostly static data? If the cost of maintaining the cache upto date outweighs the benefits of caching, then is it worth in the first place? IMO you should first attempt to answer these questions in the context of your application.
Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).