We now consider the element expiry when retrieving cache elements with a value loader. Previously, all cache elements that were cached using `@Cacheable(sync=true)` or used `RedisCache.get(Object, Callable)` directly were considered eternal without setting a TTL.
Original Pull Request: #234
Remove pExpireAt workaround that can lead to NullPointerException if called within a transaction/pipeline. Calls to expire(…) with a timeout greater Integer.MAX_VALUE are delegated to pExpire converting seconds to milliseconds.
Related ticket: DATAREDIS-286.
Original Pull Request: #228
Run expiry tests only when executing long-running tests. Guard RedisConnectionFactory against multiple initializations. Synchronize key expiry. Remove unused code. Extend years in license header.
Original pull request: #232.
We now no longer rely on ApplicationEvents captured in the RedisKeyValueAdapter for performing cleanup operations for expired keys, but do this along with the phantom key removal. This removes a flaw when initializing a non repository related KeyspaceEventListener publishing events that actually are unrelated to the Adapter.
Additionally upgraded test infrastructure to utilize Redis 3.2.6 with disabled protected-mode and enabled keyspace-events.
Original pull request: #232.
Extend JavaDoc documentation for Command/Connection/Operation interfaces. Align method ordering in operation interfaces with connection/commands interfaces.
Apply client name to Sentinel and unpooled connections if set. Add ticket references to JavaDoc. Add tests. Fix existing JavaDoc letter casing and punctuation. Rearrange isClusterAware/isRedisSentinelAware methods.
Original pull request: #219.
Motivation:
JedisConnectionFactory should support setting clientName for Jedis connections
so to improve troubleshooting.
Result:
Easier to troubleshooting with connection name.
Original pull request: #219.
Enhance JavaDoc. Improve assertions. Reduce accepted collection-type boundary to Collection for commands that do not enforce a specific order. Add ByteUtil.getBytes(ByteBuffer) utility method. Reformat code. Extend documentation
Fix parameter ambiguity in LettuceConnection.watch().
Original pull request: #229.
We introduced reactor based reactive connection support via ReactiveRedisConnection and ReactiveRedisClusterConnection.
A reactive connection can be obtained via the ConnectionFactory. This is currently only possible when using the Lettuce Redis driver.
Original pull request: #229.
Improve javadoc. Replace static method imports with qualified method calls. Refactor duplicate RedisCacheKey construction into own method. Fix formatting.
Original pull request: #221.
Store `NullValue` placeholders when null value caching is allowed. Remove cache values when null value caching is disabled and the value loader returns a `null` value.
Original pull request: #221.
We now support caching `null` values in `RedisCache` by storing a dedicated `NullValue` reference as a placeholder. To enable this feature please set up `RedisCacheManager` accordingly and make sure the used `RedisSerializer` is capable of dealing the `NullValue` type.
Both the `JdkSerializationRedisSerializer` and the `GenericJackson2JsonRedisSerializer` support this out of the box.
Original pull request: #221.
RedisCache now expires keys using putIfAbsent if the key was set. Previously, the key was only expired if the value was already present and the value matched the value stored inside of Redis.
Original Pull Request: #224
We now allow usage of @GeoIndexed to mark GeoLocation or Point properties as candidates for secondary index creation. Non null values will be included in GEOADD command as follows:
GEOADD keyspace:property-path point.x point.y entity-id
@GeoIndexed can be used on top level as well as on nested properties.
class Person {
@Id String id;
String firstname, lastname;
Address hometown;
}
class Address {
String city, street, housenumber;
@GeoIndexed Point location;
}
The above allows us to derive geospatial queries from a given method using NEAR and WITHIN keywords like:
interface PersonRepository extends CrudRepository<Person, String> {
List<Person> findByAddressLocationNear(Point point, Distance distance);
List<Person> findByAddressLocationWithin(Circle circle);
}
Partial updates on the Point itself also trigger an index refresh operation. So it is possible to alter existing entities via:
template.save(new PartialUpdate<Person>("1", Person.class).set("address.location", new Point(17, 18));
Original pull request: #215.
We now make sure to count records without using criteria when derived criteria is empty. This allows usage of declared query methods using `Pageable` without criteria like `findBy(Pageable page)`.
Original Pull Request: #220
We now make sure to pipe finder queries without any criteria to the according find all method. This allows usage of `PagingAndSortingRepository.findAllBy(Pageable page)` as well as finders without any criteria like `findTop3By()`.
Original pull request: #216.
SCAN, SSCAN, HSCAN and ZSCAN now reference a dedicated connection that is bound to the Cursor. This allows creation of multiple cursors for different threads without the risk of potentially sharing a single connection. As before the caller is responsible for closing the Cursor correctly after usage.
Original pull request: #218.
We now unbind and release the connection from the transaction resources after a Redis command is invoked. Redis read operations return always null while using RedisTemplate in a transaction so Redis read transactions are not useful.
Previously, RedisConnection's were bound as transactional resource when used in the scope of a @Transactional(readOnly = true) method but not released on transaction completion. This was, because connections are not registered with a transaction synchronizer.
Original Pull Request: #214
We now rely on getMissingCache and loadCaches for initialization instead of explicitly calling deprecated addCache method.
Original pull request: #212.
We now support Jedis 2.9.0 with Redis Standalone SSL and Redis Cluster with passwords. The code is compatible with Jedis 2.8.0 when not using SSL or Redis Cluster with passwords.
Original Pull Request: #211
Move duplicate code into single place and use ternary expressions where applicable.
Use static imports in tests where applicable.
Original Pull Request: #210
Allow reading of the TTL into primitive properties. Allow general numeric types for TTL properties. Extend date range in license headers. Extend JavaDoc.
Original pull request: #208.
We now support ttl and pttl accepting a TimeUnit on connection level to return the TTL in the requested time unit. By performing the conversion inside the connection we return correct results for plain, pipelining and transaction execution. Add also JavaDoc and @Override to ttl/pttl methods.
Original pull request: #205.
getExpire returns now negative values without time unit conversion in case of absent values or values without a TTL set.
CLA: 143520151016081625 (Duobiao Ou)
Original pull request: #205.
We now make sure to leave existing indexes untouched when using PartialUpdate.
We also fixed a glitch, where index values have not been removed correctly when saving entities with null values, along the way.
Original pull request: #207.
LettuceConnectionFactory and DefaultLettucePool now use the configured password to authenticate with Redis. Authentication is applied when connecting to nodes that were obtained from Redis Sentinel.
Original Pull Request: #204
Extend date range in license header. Retrieve connection and config for possible reconfiguration only if keyspaceNotificationsConfigParameter has a value.
Original pull request: #202.
We now allow setting the desired notify-keyspace-events server configuration via @EnableRedisRepsoitories. Use `null` or an empty String for not touching the server’s config. The default is `Ex`.
Original pull request: #202.
RedisTemplate executePipelined(RedisCallback) uses now the Hash Key and Hash Value serializers to deserialize the response.
Original pull request: #190.
CLA: 174020160421053943 (Anqing Shao).
Update reference documentation. Enhance JavaDoc. Remove destroy of managed bean. Refactor property update of writePartialUpdate into own method. Remove trailing whitespaces in JavaDoc.
Original pull request: #191.
We now allow partial update of domain types via PartialUpdate. The according expiration times and secondary index structures are updated accordingly.
In some cases it is not necessary to load and rewrite the entire entity just to set a new value within it. A session timestamp for last active time might be such a scenario where you just want to alter one property.
`PartialUpdate` allows to define `set`, `delete` actions on existing objects while taking care of updating potential expiration times of the entity itself as well as index structures.
.Sample Partial Update
====
[source,java]
----
PartialUpdate<Person> update = new PartialUpdate<Person>("e2c7dcee", Person.class)
.set("firstname", "mat") <1>
.set("address.city", "emond's field") <2>
.del("age"); <3>
template.update(update);
update = new PartialUpdate<Person>("e2c7dcee", Person.class)
.set("address", new Address("caemlyn", "andor")) <4>
.set("attributes", singletonMap("eye-color", "grey")); <5>
template.update(update);
update = new PartialUpdate<Person>("e2c7dcee", Person.class)
.refreshTtl(true); <6>
.set("expiration", 1000);
template.update(update);
----
<1> Set the simple property _firstname_ to _mat_
<2> Set the simple property _address.city_ to _emond's field_ without having to pass in the entire object. This does not work when a custom conversion is registered.
<3> Remove the property _age_.
<4> Set complex property _address_.
<5> Set a map/collection of values removes the previously existing map/collection and replaces the values with the given ones.
<6> Automatically update the server expiration time when altering time to live.
====
NOTE: Updating complex objects as well as map/collection structures requires further interaction with Redis to determine existing values which means that it might turn out that rewriting the entire entity might be faster.
Original pull request: #191.