File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Caching solution required to cache the data in memory.

 
john sal
Ranch Hand
Posts: 93
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Profiling our app has revealed that a significant chunk of time is spent in database calls (all of them are basic select SQLs with differnt attributes). DB trips to fetch the data is ofcourse a performance hit.

Now to avoid this frequent db trips we are planning to keep the entire data in the temporary cache.

Can someone plese point me about any freeware caching solutions provideded that i can use to cache the db data so that i can fetch the data from the cache in a same way
like it is fetched from the DB and which also provides a efficient storage capability.

Moreover the cache that we would be maintaining is not a static cache and data will be added and deleted in it very frequently.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Moreover the cache that we would be maintaining is not a static cache and data will be added and deleted in it very frequently.

How do you avoid your database and cache diverging fairly significantly quite quickly? If the cache is you primary point of data access, should you not abandon the DB altogether and use a caching implementation that has a secondary disk cache? There are loads: EHCache, JCS, OSCache, Terracotta etc.
 
john sal
Ranch Hand
Posts: 93
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are thinking of designing in such a way that data is stored back in the db periodically means we will do batch update of the data stored in the cache.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then something like Hibernate using a second level cache might be a way to go. You can pull data into the second level cache on demand and flush the cache periodically and the caching is configurable declaratively.

This might not be a solution if you need custom code to handle conflicts in your batch update (i.e. when someone else has updated the database or the cached data diverges from the data model constraints (by accident or design)). That would need to be bespoke.
 
john sal
Ranch Hand
Posts: 93
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya using ORM tool like hibernate is always a better solution for such kind of scenario but unfortunately due to the large migration issues don't have luxury to use the hibernate. As of now we have to either implement it seperately or have to use some external API's for caching the data.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic