nl.surfnet.coin.shared.cache
Class MethodNameAwareCacheKeyGenerator
java.lang.Object
org.springframework.cache.interceptor.DefaultKeyGenerator
nl.surfnet.coin.shared.cache.MethodNameAwareCacheKeyGenerator
- All Implemented Interfaces:
- org.springframework.cache.interceptor.KeyGenerator
public class MethodNameAwareCacheKeyGenerator
- extends org.springframework.cache.interceptor.DefaultKeyGenerator
- implements org.springframework.cache.interceptor.KeyGenerator
KeyGenerator that also takes into account the methodName when
generating keys. This appeared to be necessary in JanusClientDetailsService
(see the #testCache method in the corresponding unit test class)
Also added target.hashCode(), to differentiate between cacheable methods that have the same signature
(potentially even the same class, only being different instances of the class)
| Fields inherited from class org.springframework.cache.interceptor.DefaultKeyGenerator |
NO_PARAM_KEY, NULL_PARAM_KEY |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MethodNameAwareCacheKeyGenerator
public MethodNameAwareCacheKeyGenerator()
generate
public Object generate(Object target,
Method method,
Object... params)
- Specified by:
generate in interface org.springframework.cache.interceptor.KeyGenerator- Overrides:
generate in class org.springframework.cache.interceptor.DefaultKeyGenerator
Copyright © 2009–2013 SURFnet bv, The Netherlands. All rights reserved.