-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Align programmatic and annotation cache API #4
Comments
I have already worked on something similar. Here is the list of common issues during automatic key generation:
|
@OndrejM: what type is @eolivelli: I really like the idea of annotations on parameters to select arguments for key generation I also wonder why the spec forces all keys to implement the |
The spec should follow the same pattern as the HashMap<K,V>, where you can specify the types of Keys in the map, but the get() signature is get(Object k) because when finding V, you only care that k.hash and k.equals matches the key in the map. The type doesn't matter. |
The default cache key for annotation API is not defined. The JCache JSR 107 only provides a way to generate the key of type GeneratedCacheKey, which implies that the default cache key must also implement that interface.
It is not easy to access a cache defined by annotations on methods with the programmatic API, as the default class of the key is unknown. It would help if it was possible to acquire a default instance of GeneratedCacheKey for varargs params matching the arguments to annotated methods.
The following does not work:
The following might work to get the value from cache programmatically, with defining a custom CacheKey generator:
The text was updated successfully, but these errors were encountered: