Skip to content

Releases: redis/jedis

5.1.3

21 May 11:37
Compare
Choose a tag to compare

Changes

🚀 New Features

  • Custom connection pool to MultiClusterPooledConnectionProvider (#3801)

🐛 Bug Fixes

  • Consider null values in empty StreamPendingSummary (#3793)
  • Fix UnifiedJedis pexpireAt glitch (#3782)
  • Use expiryOption in PipelineBase.expireAt (#3777)

🧰 Maintenance

  • Add TS.INFO [DEGUB] and CF.MEXISTS in pipelined commands (#3787)
  • Fix typo in SetPipelineCommands method name (#3773)
  • Bump jackson.version from 2.16.1 to 2.16.2 (#3762)

Contributors

We'd like to thank all the contributors who worked on this release!

@gerzse, @sazzad16, @thachlp and @jarkus4

5.2.0-beta2

07 May 10:31
27e1553
Compare
Choose a tag to compare
5.2.0-beta2 Pre-release
Pre-release

What's new

This release supports server-assisted, client-side caching, and is currently beta grade.

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

How to try Client-Side Caching

  1. Install Jedis 5.2.0-beta2
  2. Choose and install a caching library: Google Guava or Caffeine
  3. Use the following code example to get started:
import redis.clients.jedis.*;
import redis.clients.jedis.csc.*;

class CacheExample {
    public static void main() {
        HostAndPort node = HostAndPort.from("localhost:6379");
        JedisClientConfig clientConfig = DefaultJedisClientConfig.builder()
                                            .resp3()                // RESP3 protocol
                                            //.user("myuser")       // Redis server username (optional)
                                            //.password("mypass")   // Redis user's password (optional)
                                            .build();

        ClientSideCache clientSideCache;
        // Uncomment one of the following lines to use the corresponding cache backend
        // GuavaClientSideCache clientSideCache = GuavaClientSideCache.builder().maximumSize(10_000).ttl(100).build();
        // CaffeineClientSideCache clientSideCache = CaffeineClientSideCache.builder().maximumSize(10_000).ttl(100).build();

        UnifiedJedis client = new UnifiedJedis(node, clientConfig, clientSideCache);
        // JedisPooled client = new JedisPooled(node, clientConfig, clientSideCache);
        // JedisCluster client = new JedisCluster(Collections.singleton(node), clientConfig, clientSideCache);

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

        client.close();
    }
}

It is highly recommended to use a ClientSideCache implementation with TTL.
Both of our provided GuavaClientSideCache and CaffeineClientSideCache have TTL support and use a default value when not set. It is discouraged to use ttl(0) in these.

It is also a good idea to keep the idle connections busy to get more and updated notifications. It can be done easily using pool config:

GenericObjectPoolConfig<Connection> poolConfig = new ConnectionPoolConfig();
poolConfig.setTestWhileIdle(true);              // ConnectionPoolConfig by default does this.
                                                // It is still shown here for better understanding.

This pool config can be used as follows:

JedisPooled client = new JedisPooled(node, clientConfig, clientSideCache, poolConfig);
JedisCluster client = new JedisCluster(Collections.singleton(node), clientConfig, clientSideCache, poolConfig);

It is possible to limit or ignore commands and/or keys for client side caching. For example, if we want to ignore some keys based on their prefix, we can define a ClientSideCacheable:

final String IGNORE_PREFIX = "PREFIX_TO_IGNORE";
ClientSideCacheable isCacheable = new ClientSideCacheable() {
    @Override
    public boolean isCacheable(ProtocolCommand command, Object... keys) {
        for (String key : (String[]) keys) { // assuming we'll only execute methods with String keys
            if (key.startsWith(IGNORE_PREFIX)) {
                return false;
            }
        }
        return true;
    }
};

This ClientSideCacheable can be a parameter for ClientSideCache. In our provided implementations, it can be:

GuavaClientSideCache clientSideCache = GuavaClientSideCache.builder().cacheable(isCacheable).build();
CaffeineClientSideCache clientSideCache = CaffeineClientSideCache.builder().cacheable(isCacheable).build();

It is also possible to create client-side caching enabled client object using URL/URI with proper query params. Supported params are:

  • cache_lib (caching library) - required; can be either guava or caffeine
  • cache_max_size (maximum no of commands) - optional
  • cache_ttl (time-to-live, in seconds) - optional

For example:

JedisPooled client = new JedisPooled("redis://myuser:mypass@localhost:6379/?cache_lib=guava&cache_max_size=10000&cache_ttl=100");

4.4.8

04 Apr 08:29
Compare
Choose a tag to compare

Changes

🐛 Bug Fixes

  • Fix ZREVRANGE versions with max/min swapped in MultiNodePipelineBase (#3784)
  • Use expiryOption in PipelineBase.expireAt (#3777)
  • Fix UnifiedJedis pexpireAt glitch (#3782)
  • Consider null values in empty StreamPendingSummary (#3793)

Contributors

We'd like to thank all the contributors who worked on this release!

@sazzad16 and @keeferrourke

5.2.0-beta1

11 Mar 02:20
dc35d45
Compare
Choose a tag to compare
5.2.0-beta1 Pre-release
Pre-release

What's new

This release supports server-assisted, client-side caching, and is currently beta grade.

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

How to try Client-Side Caching

  1. Install Jedis 5.2.0-beta1
  2. Choose and install a caching library: Google Guava or Caffeine
  3. Use the following code example to get started:
import redis.clients.jedis.*;
import redis.clients.jedis.csc.*;

class CacheExample {
    public static void main() {
        HostAndPort node = HostAndPort.from("localhost:6379");
        JedisClientConfig clientConfig = DefaultJedisClientConfig.builder()
                                            .resp3()                // RESP3 protocol
                                            //.user("myuser")       // Redis server username (optional)
                                            //.password("mypass")   // Redis user's password (optional)
                                            .build();

        ClientSideCache clientSideCache;
        // Uncomment one of the following lines to use the corresponding cache backend
        // GuavaClientSideCache clientSideCache = GuavaClientSideCache.builder().maximumSize(10_000).ttl(100).build();
        // CaffeineClientSideCache clientSideCache = CaffeineClientSideCache.builder().maximumSize(10_000).ttl(100).build();

        UnifiedJedis client = new UnifiedJedis(node, clientConfig, clientSideCache);
        // JedisPooled client = new JedisPooled(node, clientConfig, clientSideCache);
        // JedisCluster client = new JedisCluster(Collections.singleton(node), clientConfig, clientSideCache);

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

        client.close();
    }
}

It is highly recommended to use a ClientSideCache implementation with TTL.
Both of our provided GuavaClientSideCache and CaffeineClientSideCache have TTL support and use a default value when not set. It is discouraged to use ttl(0) in these.

It is also a good idea to keep the idle connections busy to get more and updated notifications. It can be done easily using pool config:

GenericObjectPoolConfig<Connection> poolConfig = new ConnectionPoolConfig();
poolConfig.setTestWhileIdle(true);              // ConnectionPoolConfig by default does this.
                                                // It is still shown here for better understanding.

This pool config can be used as follows:

JedisPooled client = new JedisPooled(node, clientConfig, clientSideCache, poolConfig);
JedisCluster client = new JedisCluster(Collections.singleton(node), clientConfig, clientSideCache, poolConfig);

It is possible to limit or ignore commands and/or keys for client side caching. For example, if we want to ignore some keys based on their prefix, we can define a ClientSideCacheable:

final String IGNORE_PREFIX = "PREFIX_TO_IGNORE";
ClientSideCacheable isCacheable = new ClientSideCacheable() {
    @Override
    public boolean isCacheable(ProtocolCommand command, Object... keys) {
        for (String key : (String[]) keys) { // assuming we'll only execute methods with String keys
            if (key.startsWith(IGNORE_PREFIX)) {
                return false;
            }
        }
        return true;
    }
};

This ClientSideCacheable can be a parameter for ClientSideCache. In our provided implementations, it can be:

GuavaClientSideCache clientSideCache = GuavaClientSideCache.builder().cacheable(isCacheable).build();
CaffeineClientSideCache clientSideCache = CaffeineClientSideCache.builder().cacheable(isCacheable).build();

It is also possible to create client-side caching enabled client object using URL/URI with proper query params. Supported params are:

  • cache_lib (caching library) - required; can be either guava or caffeine
  • cache_max_size (maximum no of commands) - optional
  • cache_ttl (time-to-live, in seconds) - optional

For example:

JedisPooled client = new JedisPooled("redis://myuser:mypass@localhost:6379/?cache_lib=guava&cache_max_size=10000&cache_ttl=100");

5.1.2

06 Mar 11:16
Compare
Choose a tag to compare

Changes

🐛 Bug Fixes

  • Stop connection fetching before sync/exec in multi cluster failover mode (#3756)

5.2.0-alpha3

26 Feb 05:31
2480b02
Compare
Choose a tag to compare
5.2.0-alpha3 Pre-release
Pre-release

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().maximumSize(1000).ttl(100).build();
        // ClientSideCache csc = CaffeineCSC.builder().maximumSize(1000).ttl(100).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();
    }
}

4.4.7

26 Feb 06:28
Compare
Choose a tag to compare

Changes

🚀 New Features

  • Added HSET variants to ease complex objects (#3605)

🐛 Bug Fixes

  • Avoid NPE in MultiNodePipelineBase.java (#3697)
  • Direct FT.CREATE to proper node in LIGHT search mode (#3593)

🧰 Maintenance

  • Use simple version of HSET (#3587)
  • Deprecate RediSearchUtil#ToByteArray

Contributors

We'd like to thank all the contributors who worked on this release!

@sazzad16 and @stillerrr

5.1.1

26 Feb 06:09
64b5aac
Compare
Choose a tag to compare

Changes

🐛 Bug Fixes

  • Avoid NPE in MultiNodePipelineBase.java (#3697)
  • Fix probable missing (RESP3) protocol processing (#3692)
  • Use circuit breaker fallback exception list (#3664)

🧰 Maintenance

  • Access Reducer attributes (#3637)
  • Replace deprecated set-output command with environment file (#3622)
  • Bump jackson.version from 2.16.0 to 2.16.1 (#3666)
  • Bump jackson databind and jsr310 to 2.16.0 (#3655)
  • Bump com.kohlschutter.junixsocket:junixsocket-core from 2.8.1 to 2.8.3 (#3647)

Contributors

We'd like to thank all the contributors who worked on this release!

@dependabot, @dependabot[bot], @jongwooo, @sazzad16 and @stillerrr

5.2.0-alpha2

28 Dec 16:19
Compare
Choose a tag to compare
5.2.0-alpha2 Pre-release
Pre-release

This release provides support for server-assisted, client-side caching, and is currently alpha grade. Currently it is supported on top of the Jedis class, and will be merged to Jedis/UnifiedJedis classes via configuration parameters.

Client-side caching is available through JedisClientSideCache class, with RESP3 only.

Note: The process of ensuring the last invalidation when there is none, is still time consuming; it is suggested to use a smaller socket timeout if this is an issue. We have started with only GET command at this moment.

import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisClientConfig;
import redis.clients.jedis.DefaultJedisClientConfig;
import redis.clients.jedis.JedisClientSideCache;

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

        JedisClientSideCache jCache = new JedisClientSideCache(hnp, config);

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

        jCache.close();
    }
}

5.2.0-alpha1

28 Dec 13:22
da9c463
Compare
Choose a tag to compare
5.2.0-alpha1 Pre-release
Pre-release

Re-released as 5.2.0-alpha2.