Update documentation and fix spelling in JavaDoc and reference documentation.
Allow node lookup by host/port and node Id to enable flexibility when passing references to Redis Cluster nodes. Parse multiple slot ranges for a cluster node and move CLUSTER NODES parser to Converters.
Use fixed line separator instead of OS-specific line separator, consolidate duplicate code, support clusterSetSlotStable with lettuce 3.4 and set lettuce driver shutdown timeout to zero for long running tests.
Original pull request: #158.
Cluster support is based on the very same building blocks as non clustered communication. RedisClusterConnection and extension to RedisConnection handles the communication with the Redis Cluster and translates errors into the Spring DAO exception hierarchy.
Redirects for to a specific keys to the corresponding slot serving node are handled by the driver libraries, higher level functions like collecting information accross nodes, or sending commands to all nodes in the cluster that are covered by RedisClusterConnection utilizing a ClusterCommandExecutor distributing commands accross the cluster and collecting results.
RedisTemplate provides access to cluster specific operations via the ClusterOperations interface that can be obtained via RedisTemplate.opsForCluster(). This allows to execute commands explicitly on a single node within the cluster while retaining de-/serialization features configured for the template.
Original pull request: #158.
As of Spring Framework 4.3.RC1, the `Cache` interface has a new `<T> T get(Object key, Callable<T> valueLoader);` method (see SPR-9254).
If no entry for the given key is found, the `Callable` is invoked to compute/load the value that is then put into redis and returned. Additionally concurrent calls get synchronized so that the `Callable` is only called once.
Using Spring Framework 4.3 failures result in `o.s.c.Cache$ValueRetrievalException` prior versions use `RedisSystemException`.
Original pull request: #162.
We now actively select the predefined db set via the dbIndex on LettuceConnectionFactory. Fixed some spelling issues along the way.
Original pull request: #157.
ScanCursor now retriggers SCAN command for results having a new cursorId but no actual values. This avoids NoSuchElementException for server calls like:
scan 0 match key*9
1) 1966080
2) (empty list or set)
Original Pull Request: #154
CLA Number: 143520151016081625 (Duobiao Ou)
We now make sure the available HashMapper implementations avoid exposing null values. Prior to this null values would have been added to the converted Hash causing trouble when saving those to redis since hashes are expected to not contain any null values
We introduced GenericJackson2JsonRedisSerializer holding a preconfigured ObjectMapper which writes Class type informations into the JSON structure. This enables polymorphic deserialization and allows RedisCache manager to operate upon a RedisTemplate storing data in JSON format, which had until this only been possible using the Jdk Serializer.
Fixed connection problems leaving sockets open. Added missing JUnit rules for Sentinels. Added missing author information update, license header and Javadoc.
Upgraded test script to use Redis 3.0.2. Upgrade test script to shut down Redis in case of test errors. Added Redis 3.0 to TestProfileValueSource. Enabled ZRANGEBYLEX tests for lettuce.
Original pull request: #144.
Related pull request: #104.
Updated lettuce redis client to latest snapshot, adopt changed API and use API for commands which were emulated using LUA script
Implemente Sentinel support using lettuce library, adopt finer grained exceptions and aligned exception behavior to match other libraries. Added shutdown-timeout property in order to control shutdown duration of the netty framework which reduces test run duration. Documentation updated as well. Contains also a fix to use psetex instead of setex (typo).
Switch to Jedis for Redis Version discovery in tests. Polished documentation. Use LettuceConverter and native time() method.
Original pull request: #144.
Related pull request: #104.
Moved key serialization and value deserialization outside of callback so that pooled connections get released more quickly.
Original pull request: #153.
We now return null for RedisCache.putIfAbesent(…) when value is set to meet the contract defined by org.springframework.cache.Cache.putIfAbsent(…).
Original pull request: #150.
Bump Jedis version and fix SendCommand class type differences between versions.
We now also lazily init the transaction on first call of multi() since pre initialization causes issues releasing Jedis connections and returning them to pool.
Original pull request: #149.
Related ticket: #139.
We now no longer require RedisCache and RedisCacheManager to be initialized with a RedisTemplate but use RedisOperations instead.
Original pull request: #142.
We now allow usage of Range and Limit types (newly introduced for ZRANGEBYLEX) on mostly all ZSET range operations.
Extracted constants for plus/minus and -inf/+inf expressions.
Original pull request: #138.
Adapted sendCommand lookup in JedisConnection to honor the changed signature of redis.clients.jedis.Connection.sendCommand(Command, String…) to redis.clients.jedis.Connection.sendCommand(ProtocolCommand, String…).
Original pull request: #140.
We now support ZRANGEBYLEX on RedisConnection and StringRedisConnection when using the Jedis driver. The upper and lower bounds can be defined using the Range type which will be converted to the according binary representation including prefix and/or infinite operators.
range().gt("a") => (a +
range().gte("a") => [a +
range().lt("z") => - (z
range().lte("z") => - [z
range().gte("a").lt("z") => [a (z
We only unbind the current redisConnectionFactory from the current thread if the transaction is not active anymore.
Previously we performed the unbinding in RedisTemplate.execute(RedisCallback, boolean, boolean) overtime which lead to the fact that the next redis operation within the same transaction used a different redis connection, which could lead to exhaustion of the connection pool.
We also ensure that we correctly unbind the RedisConnectionFactory resource from the TransactionSynchronizationManager on transaction completion in RedisTransactionSynchronizer.afterCompletion(int).
Added test case supplied from issue.
Original pull request: #134.
We now support both Jedis 2.6.2 (current release) as well as the upcoming 2.7 version. Therefore we call the in 2.7 renamed `getTimeout` / `setTimeout` Methods on `JedisShardInfo` via reflection to read/set `soTimeout`.
Since there’s no change in r.c.j.JedisFactory that would allow to individually configure connection and socket timeout, we use the socketTimeout of `JedisShardInfo`. This will cause `r.c.j.JedisFactory` to use the socket timeout for the connection as well, which is the same behavior as in 2.6.2.
Tested against Jedis 2.7 branch with Redis 3.0.0.RC4.
Original Pull Request: #127
Previously a transactional RedisCacheManager decorated a cache with the TransactionAwareCacheDecorator twice. We now make sure that a particular cache is only decorated once with a TransactionAwareCacheDecorator.
Original Pull Request: #128
We now allow to initialize a RedisSentinelConfiguration based on a given String collection of host:ports.
sentinelHostAndPorts[0] = 127.0.0.1:23679
sentinelHostAndPorts[1] = 127.0.0.1:23680
Further on it’s possible to pass in a PropertySource containing master name and sentinel nodes.
spring.redis.sentinel.master=myMaster
spring.redis.sentinel.nodes=127.0.0.1:23679,127.0.0.1:23680
Original pull request: #126.
Introduce dedicated types RedisCache is supposed to work upon. We still stick to the contract defined by previous versions to assure source and binary compatibility.
In a next step RedisCache should be decoupled from o.s.cache.Cache by an additional indirection via RedisCacheCache.
Original Pull Request: #122
We now check the presence of a prefix which allows to identify the keys associated with the cache to either keep track of keys or use the prefix to remove them on clear.
This is a small fix intended to be back ported to the Evans (1.4.x) release train. Additional refactoring will be done for the Fowler release.
Original Pull Request: #122
We now construct the caches for the configured cache-names in afterPropertiesSet(). Previously the caches were created in the setter which lead to unwanted property-set order dependencies.
Original pull request: #123.
We now allow users to build custom CacheManagers based on RedisCacheManager more easily by making a broader API accessible to sub-classes.
In that sense we also allowing RedisCache to be used in custom implementations by making it public.
Original pull request: #120.
We now check for a NonTransientDataAccessException instead of just an UncategorizedDataAccessException to conver all relevant exception types.
Corrected typo in method name. Added infrastructure for driver specific DefaultScriptExecutorTests.
Removed usage of RelaxedJunit4ClassRuner and using MinimumRedisRule
instead.
Removed obsolete test context configuration for ScriptExecutorTests.
Original pull request: #115.
We now allow to customise the JavaType to use for a given Class<> by using the getJavaType method. Added constructor variants to JacksonJsonRedisSerializer and Jackson2JsonRedisSerializer.
Original pull request: #113.
We added methods for PFADD, PFCOUNT and PFMERGE to RedisConnection and StringRedisConnection. HyperLogLogOperations available via RedisTemplate allow more indrect usage of HLL.
Please note that currently Jedis is the only driver that can be used for HyperLogLog commands.
Original pull request: #116.
Added additional leftPushAll and rightPushAll method overloads that accept a Collection parameter.
Previously we only accepted varargs which required users to convert collections to arrays.
Based on David Liu's pull request: #100.
Original pull request: #114.
We now support open zset's interval for JedisConnection, JredisConnection, LettuceConnection, SrpConnection and DefaultStringRedisConnection.
Original pull request: #97.
We now inspect the message of the exception thrown to determine whether the error resulted from a script not being present or an other error. In case the script is not present we simply invoke eval.
Original pull request: #108
It turned out that the version check throttled performance so we moved things around to avoid iterating multiple times and still perform the check in a non intrusive way.
Optimize initial size of HashSet and use a Set implementation to check for score duplicates.
Move jedis version check outside loop.
Original PR: #101
CLA: 90520140903040912 (Konstantin Shchepanovskyi)
Previously overriding message handler methods of the delegate passed to MessageListenerAdapter resulted in the message handler method called multiple times. We now make sure that a message handler method is only found and invoked once.
Original pull request: #95.
add support for commands:
SENTINEL FAILOVER master
SENTINEL SLAVES master
SENTINEL REMOVE name
SENTINEL MONITOR name ip port quorum
Original pull request: #92.
We’ve added RedisSentinelConfiguration holding required information for connecting to redis sentinels. This can be used to set up ConnectionFeactory for HA environments.
**Using Jedis**
Providing RedisSentinelConfiguration will force the JedisConnectionFactory to use JedisSentinelPool for managing resources.
**Using Lettuce/JRedis/SRP**
There’s currently no support for sentinel in those clients.
**CI Build**
We’ve added makefile to build and set up redis instances for testing sentinel support on travis-ci. There’s already a section for redis cluster.
The cluster section is for whatever reason currently not working as the cluster nodes won’t start.
This will be fixed when we add redis-cluster support.
_side note:_ there’s an alternative fork of lettuce at mp911de/lettuce that already has sentinel support.
* JedisConnection.eval() uses binary version of Jedis.eval()
* but JedisConnection.evalsha() uses string version of Jedis.evalsha()
* this commit changes JedisConnection.evalsha() to use binary version of Jedis.evalsha()
---
Original Pull Request: #91
CLA: 88220140729064528 (Jungtaek Lim)
We now consistently return null in implementations of RedisConnectionFactory#translateExceptionIfPossible(RuntimeException ex)
in cases where we cannot translate the given exception into a more meaningful one complying with the spec of PersistenceExceptionTranslator. Introduced the ExceptionTranslationStrategy abstraction which allows to customise the translation of exceptions through the implementations PassThroughExceptionTranslationStrategy which returns null iif the Exception could not be translated and FallbackExceptionTranslationStrategy which returns a RedisSystemException wrapping the original Exception if it couldn't be translated properly.
This fix also solves the issues DATAREDIS-295, DATAREDIS-325, DATAREDIS-326.
Original pull request: #90.
We now serialise the key and value before trying to acquire the lock to make sure that the given key and value are written in state they were at method invocation time.
Original pull request: #85.
We now validate the given RedisTemplate in the constructor of RedisAtomicLong/RedisAtomicInteger/RedisAtomicDouble to report an inappropriate RedisTemplate more eagerly.
Original pull request: #83.