Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Spring cache ?

 
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • 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
  • 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: 396
8
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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
  • 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: 396
8
  • Mark post as helpful
  • send pies
  • 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: 8934
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
  • 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
  • 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

 
I can't take it! You are too smart for me! Here is the tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!