github redis/jedis v5.2.0-alpha3
5.2.0-alpha3

latest releases: v5.2.0, v5.2.0-beta5, v5.1.5...
pre-release9 months ago

This release provides support for server-assisted, client-side caching, and is currently alpha grade.

Client-side caching is available within UnifiedJedis, JedisPooled, JedisCluster, etc classes via implementation of ClientSideCache class, with RESP3 only. It is recommended a ClientSideCache implementation with TTL (time-to-live). We have included two implementations based on Google Guava and Caffeine libraries.

class CacheExample {
    public static void main() {
        HostAndPort hnp = HostAndPort.from("localhost:6379");
        JedisClientConfig config = DefaultJedisClientConfig.builder()
                                            .resp3()                    // RESP3 protocol
                                            .password("foobared")
                                            .build();

        ClientSideCache csc;
        // ClientSideCache csc = GuavaCSC.builder().build();
        // ClientSideCache csc = CaffeineCSC.builder().build();

        UnifiedJedis client = new UnifiedJedis(hnp, config, csc);
        // JedisPooled client = new JedisPooled(hnp, config, csc);
        // JedisCluster client = new JedisCluster(Collections.singleton(hnp), config, csc);

        client.set("foo", "bar");
        client.get("foo");
        client.get("foo");      // cache hit
        client.del("foo");

        client.close();
    }
}

Don't miss a new jedis release

NewReleases is sending notifications on new releases.