qaware / collection-cacheable-for-spring

Spring cache extension for putting a whole collection of entities as single cache items
Apache License 2.0
60 stars 9 forks source link

@CollectionCacheable completely ignored #36

Open Richie94 opened 2 years ago

Richie94 commented 2 years ago

Hey there,

I just try to get it run with your annotation, but it seems like this annotation gets completely ignored. I have @EnableCaching and also my @Cacheable annotations work like expected, but not the CollectionCacheable.

Im using Spring 2.7.5 and Kotlin, but also tried makeing a class with java where it also did not work. I see, that the CollectionCacheableCacheInterceptor gets called in the debug mode, but never checks my annotation.

Also I have the question as I where not able to test it, if it is intended that multiple calls to en empty findAll() Method would use the cache. So that first call sees its empty, so Im putting all with their key inside and second call just gets all the entries from a cache and returns it.

neiser commented 2 years ago

Hi @Richie94

I've merged the Spring Boot 2.7.5 only in 1.3.1-SNAPSHOT so far, and at least the integration tests there ran fine in the Github Action. Are the examples from the README working for you? Can you come up with a minimal reproducer for the problem you're experiencing? Either as a standalone project or (preferred) as a failing test case (you may add one there via pull request)?

Regarding findAll: The README says that the return value, being a Map, puts all the returned entries into the cache using the key of the map as the cache key. This essentially fills the whole cache and subsequent findById calls are then already cached. Another call to findAll will just update the cache then (cache invalidation is out of scope here, and is usually achieved by TTLs).

Richie94 commented 2 years ago

Okay, thanks, than its not exactly what we are looking for. We aim for a mechanism on how to cache findAll so that we can have the cached result on the second call, but also using CachePut and CacheEvict only for some specific ids, which then should ideally be replaced/evicted also in the findAll Cacheable...

kwhitejr commented 1 year ago

I think I have a similar issue. After upgrading a Spring Boot app to spring-boot:3.0.2, the @CollectionCacheable annotation is seemingly ignored by the running application. Still fact-finding, but was wondering if you have plans to support.

neiser commented 1 year ago

@kwhitejr Spring Boot 3.x is currently not supported. Happy to accept PRs though.

izogfif commented 3 months ago

@kwhitejr Spring Boot 3.x is currently not supported. Happy to accept PRs though.

@neiser

Are you still happy? The PR was in there for over a month already.