I have more or less the same in a project excepted this is abstract with the key in constructor and extended with a hardcoded key then on the method I use - my method doesnt have any parameter:
@CacheResult(cacheKeyGenerator = SuperKeyKeyGenerator.class) Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber <http://www.tomitribe.com> 2015-09-02 20:18 GMT+02:00 sgjava <[email protected]>: > I've implemented a simple StringGeneratedCacheKey based on your > > https://rmannibucau.wordpress.com/2015/08/21/cacheresult-jcache-cdi-to-the-rescue-of-microservices > . > The only thing I did was add toString in order to make logging/debugging > easier. See: > > > https://github.com/sgjava/jcache-tomee/blob/master/src/main/java/com/codeferm/jcache/tomee/StringGeneratedCacheKey.java > > > https://github.com/sgjava/jcache-tomee/blob/master/src/main/java/com/codeferm/jcache/tomee/StringKeyGenerator.java > > Then direct lookup is simple matter of: > > final StringGeneratedCacheKey key = new StringGeneratedCacheKey("key1"); > final String value = testCache.get(key); > > Thanks Romain for the good info. > > > > > -- > View this message in context: > http://tomee-openejb.979440.n4.nabble.com/GeneratedCacheKey-tp4676068.html > Sent from the TomEE Users mailing list archive at Nabble.com. >
