Announcement Announcement Module
Collapse
No announcement yet.
Caching with Spring + Spring-modules-cache + oscache Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Caching with Spring + Spring-modules-cache + oscache

    I am using Spring for business layer. I would like to Cache the data in business layer. So i tried eager reading in "init" methods i.e. by defining init in applicationContext.xml . But i figured out their is a better way to do Caching using spring + spring-modules-cache + oscache

    I read from the forums the following benefits of this mechanism
    -the data gets stored in the cache the first time it is read
    next read would just retrive the data from the cache

    -there is a setting so that you can have the cache to be considered stale
    after a certain amount of time

    -so you can have a list that is "no older than 1 hour" or "data as of 1:00
    pm"

    If this info is correct then any pointers/suggestions on how to go about using this cache mechanism will be highly appreciated

    Regards
    Bansi

  • #2
    What exactly is it you want to cache? If it's actually data from the database, then it's easy to turn on in Hibernate, if you are using plain old JDBC there have been a few forum posts about this in the past. It would be useful to understand how you want this to work.
    Last edited by karldmoore; Aug 27th, 2007, 03:02 PM.

    Comment


    • #3
      Caching methods result using Spring and EHCache

      Hi

      Another way for caching "static" data is to cache the result of the method that retrieves these data, an excellent example is provided in the spring tips website, that proposes a method for Caching methods result using Spring and EHCache

      Nabil

      Comment


      • #4
        Hi,I used a cache project with spring,but i used ehCache, before i test ehcache/oscache/treecache, used single server,they executive efficiency very similar,but spring provide ehcache sustain,please find it at org.springframework.cache.ehcache package.

        i create two interceptor implements MethodInterceptor and AfterReturningAdvice, MethodInterceptor implements class purpose is create cache/put cache/find from cache, AfterReturningAdvice implements class purpose is if you create/update/delete object, it will set mutuality cache is invalidation(remove cache)....

        if you want have more about my cache project,i will attach my intact code ,hope to help you!
        Last edited by tom.duan; Jun 28th, 2007, 09:40 PM.

        Comment


        • #5
          can you post the code

          Tom,
          can you post your code here.

          Comment


          • #6
            There's an example here. If you google it you'll find there are quite a few examples out there.
            http://opensource.atlassian.com/conf...ng+and+EHCache
            Last edited by karldmoore; Aug 27th, 2007, 03:02 PM.

            Comment

            Working...
            X