-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Milestone
Description
Description
I have a method having an Class as parameter. The documentation says the following
- If the method has no arguments, then the cache key is an instance of io.quarkus.cache.DefaultCacheKey built from the cache name.
- If the method has exactly one argument, then this argument is the cache key.
- If the method has multiple arguments but only one annotated with @Cachekey, then this annotated argument is the cache key.
- In all other cases, the cache key is an instance of io.quarkus.cache.CompositeCacheKey built from multiple method arguments (annotated with @Cachekey or not).
I would like to be able to use just one single field of the class as a CacheKey
Implementation ideas
If a method is annotated with @CacheName, I could be able to have an annotation @Cachekey("name_of_parameter.name_of_field_in_class") where the parameter of the method is named "name_of_parameter" of type Clazz and it has a field "name_of_field_in_class" that will be used as cache key or in the Class of name_of_parameter Clazz, I could place the annotation @Cachekey on the field name_of_field_in_class so that it can automatically by used as a cache key when passed to a method annotated with @CacheName.
That would be helpful.