aspose file tools*
The moose likes Spring and the fly likes Spring cache ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring cache ?" Watch "Spring cache ?" New topic
Author

Spring cache ?

Abhay Agarwal
Ranch Hand

Joined: Feb 29, 2008
Posts: 1220
    
    1

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


Oracle Java Web Service Developer (1z0-897), Oracle certified Java 7 Programmer, SCJA 1.0, SCJP 5.0, SCWCD 5.0, Oracle SQL Fundamentals I, CIW Certified Ecommerce specialist
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

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


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Craig Walls
author
Ranch Hand

Joined: Sep 19, 2003
Posts: 335
    
    5
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.


Spring in Action - Unleash POJO power in your applications!
Modular Java - Discover the secret weapon to modularity on the Java platform!
XDoclet in Action - Your complete guide to code generation with XDoclet.
Sujoy Choudhury
Ranch Hand

Joined: Sep 17, 2008
Posts: 136

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?


Thanks and Regards,
~Sujoy
Craig Walls
author
Ranch Hand

Joined: Sep 19, 2003
Posts: 335
    
    5
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.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Does it support ehcache ?


Groovy
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spring cache ?