[infinispan-dev] Abstracting javax.cache.annotation.CacheKey away from the user?
Pete Muir
pmuir at redhat.com
Mon Oct 24 11:21:33 EDT 2011
I believe this is related to the use of JSR-107, it's not related to Infinispan (see the as7 quick start).
On 24 Oct 2011, at 15:15, Galder Zamarreño wrote:
> Pete/Kevin,
>
> Looking at the Infinispan CDI quickstart, I see:
>
> @GreetingCache
> private Cache<CacheKey, String> cache;
>
> The key that the user really uses here is String. So, could that be defined like this?
>
> @GreetingCache
> private Cache<String, String> cache;
>
> Btw, I've just tried this and when using the key I get:
>
> Caused by: java.lang.ClassCastException: org.infinispan.cdi.interceptor.DefaultCacheKey cannot be cast to java.lang.String
>
> Are we forcing the user to dephicer what's in CacheKey? Related to this, looking at org.infinispan.cdi.interceptor.DefaultCacheKey I see no way to retrieve individual elements of a key.
>
> My point here is whether we can avoid leaking javax.cache.annotation.CacheKey to the user cos it can do little with it without being able to get its contents.
>
> I see there;s a way to define a custom key, but that should not be necessary for a simple key based on a String for example.
>
> Cheers,
> --
> Galder Zamarreño
> Sr. Software Engineer
> Infinispan, JBoss Cache
>
More information about the infinispan-dev
mailing list