You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by sgjava <sg...@gmail.com> on 2015/09/02 20:18:14 UTC

GeneratedCacheKey

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.

Re: GeneratedCacheKey

Posted by Romain Manni-Bucau <rm...@gmail.com>.
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 <sg...@gmail.com>:

> 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.
>