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

Suggest for getting cache value from redis #40

Closed Laverrr closed 1 year ago

Laverrr commented 1 year ago

I review the code and found that CollectionCacheableCacheInterceptor#findInCaches this method get value by key from redis one by one using RedisConnection#get. If the number of keys is large, A lot of time will be wasted on network requests. Do u consider change the way of getting cache value from RedisConnection#get to RedisConnection#mget

neiser commented 1 year ago

If I'm not mistaken, Spring's cache abstraction does not support getting cache values for multiple keys in one batch operation. So there's no way to optimize this here, as this library is fully building upon that abstraction (essentially it doesn't even know that Redis exists).