0

Is there a way to specify different TTL for different CouchbaseCache objects in CouchBaseCacheManager?

@Cacheable("mycache")
public List<MyObject> findMyObjectsById(long id) {
    return myrepo.findById(id); 
}

How I make that List expire in cache after certain period of time...

vladsfl
  • 617
  • 8
  • 18
  • that's probably a duplicate of http://stackoverflow.com/questions/29037234/spring-cache-expire-using-bean-property/29102881#29102881 – Stephane Nicoll Mar 17 '15 at 16:23

1 Answers1

1

I was searching for this same answer, so I'll post my findings in case it helps someone else. There is a jira ticket out on this here: https://jira.spring.io/browse/DATACOUCH-25. It looks like TTL can be set for each named cache you create in the latest 1.2.x code branch, but is not in any of the 1.1.x branches.

You don't configure this through the @Cacheable annotation, it is configured for each named cache within your cachemanager configuration, so you'll have to create different named caches if you have objects that have different TTL.

tacree
  • 68
  • 1
  • 5