nl.surfnet.coin.shared.cache
Class MethodNameAwareCacheKeyGenerator

java.lang.Object
  extended by org.springframework.cache.interceptor.DefaultKeyGenerator
      extended by 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)


Field Summary
 
Fields inherited from class org.springframework.cache.interceptor.DefaultKeyGenerator
NO_PARAM_KEY, NULL_PARAM_KEY
 
Constructor Summary
MethodNameAwareCacheKeyGenerator()
           
 
Method Summary
 Object generate(Object target, Method method, Object... params)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodNameAwareCacheKeyGenerator

public MethodNameAwareCacheKeyGenerator()
Method Detail

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.