com.google.code.ssm.spring
Class ExtendedSSMCacheManager
java.lang.Object
org.springframework.cache.support.AbstractCacheManager
com.google.code.ssm.spring.SSMCacheManager
com.google.code.ssm.spring.ExtendedSSMCacheManager
- All Implemented Interfaces:
- InitializingBean, org.springframework.cache.CacheManager
public class ExtendedSSMCacheManager
- extends SSMCacheManager
CacheManager backed by a Simple Spring Memcached (SSM) Cache. Spring Cache and
CacheManager doesn't support configuring expiration time per method (there is no dedicated parameter in cache
annotation to pass expiration). This extension of SSMCacheManager overcomes this limitation and allow to pass
expiration time as a part of cache name. To define custom expiration on method as a cache name use concatenation of
specific cache name, separator and expiration e.g.
public class UserDAO {
// cache name: userCache, expiration: 300s
@Cacheable("userCache#300")
public User getUser(String name) {
}
}
- Since:
- 3.0.0
- Author:
- Jakub BiaĆek
| Methods inherited from class org.springframework.cache.support.AbstractCacheManager |
addCache, afterPropertiesSet, getCacheNames |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ExtendedSSMCacheManager
public ExtendedSSMCacheManager()
getCache
public org.springframework.cache.Cache getCache(String name)
- Specified by:
getCache in interface org.springframework.cache.CacheManager- Overrides:
getCache in class org.springframework.cache.support.AbstractCacheManager
getSeparator
public char getSeparator()
setSeparator
public void setSeparator(char separator)
- Char that separates cache name and expiration time, default: #.
- Parameters:
separator -
Copyright © 2013. All Rights Reserved.