• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Spring cache ?

 
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Does Spring framework has its own caching framework ?

I need to create an object in Spring MVC application and want to save it in cache.
And then later on, i want to get it from cache and read its values .

Thanks
Abhay
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
May be I didn't get your question correctly, but if you want to read that object later, then try initializing object lazily.

Caching things come when you want to access some "heavy" object often from your application.

You also like to see the Spring Cache abstraction, but it support method caching. Read for further details: http://static.springsource.org/spring/docs/3.1.0.M1/spring-framework-reference/html/cache.html
 
author
Posts: 422
13
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Abhay Agarwal wrote:Does Spring framework has its own caching framework ?



Spring 3.1 has a caching abstraction, allowing you to annotate methods with @Cacheable and @CacheEvict to control the caching of the values returned from those methods. But the caching abstract is intended to be used with a separate caching framework such as Hibernate caching or Gemfire.
 
Ranch Hand
Posts: 136
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Spring 3.1 has a caching abstraction, allowing you to annotate methods with @Cacheable and @CacheEvict to control the caching of the values returned from those methods. But the caching abstract is intended to be used with a separate caching framework such as Hibernate caching or Gemfire.



Nice to know about these new annotations. Have you discussed in your book about these in depth?
 
Craig Walls
author
Posts: 422
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, I don't cover those in the book because they're new in Spring 3.1 (which is still at milestone 2) and the book only covers up through Spring 3.0. By the time those annotations were added to the framework, the book was already well on it's way through the production process.
 
Ranch Hand
Posts: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does it support ehcache ?
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Pradeep bhatt wrote:Does it support ehcache ?

Yes

http://static.springsource.org/spring/docs/3.1.0.M1/spring-framework-reference/html/cache.html wrote:Note that just like other services in Spring Framework, the caching service is an abstraction (not a cache implementation) and requires the use of an actual storage to store the cache data - that is, the abstraction frees the developer from having to write the caching logic but does not provide the actual stores. There are two integrations available out of the box, for JDK java.util.concurrent.ConcurrentMap and Ehcache

 
reply
    Bookmark Topic Watch Topic
  • New Topic