quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.44k stars 2.58k forks source link

Add Support for Caching List Results in Quarks Redis Cache #41301

Open ngChris opened 1 month ago

ngChris commented 1 month ago

Description

Currently, the Quarkus Redis Cache implementation does not support caching methods that return a list or a collection of objects. For example, if we use caching as shown in the example below, Quarkus complains that it cannot determine the value type of the cache.

@ApplicationScoped
public class MyService {

   @CacheResult(cacheName = "namesCache")
   public List<String> fetchNames() {
       // Do complex calculation
       ... 
     }
 }

In many applications, methods that return a list of objects are common. Therefore i suggest a mechanism such that the Quarkus Redis Cache implementation can infer the type correctly and that the entire list and its contents can be serialized and deserialized correctly when stored in and retrieved from Redis.

Implementation ideas

No response

quarkus-bot[bot] commented 1 month ago

/cc @Ladicek (redis), @cescoffier (redis), @gwenneg (cache), @machi1990 (redis)