spring-projects / spring-projects/spring-data-redis
@TimeToLiveDate [DATAREDIS-1028]
@christophstrobl is already working on this.
Since Dec 30, 2020.
- Dominant language
- Java
- Stars
- 1.9k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
Chris Haines opened DATAREDIS-1028 and commented
Currently Spring Data Redis has functionality to handle the annotation @TimeToLive. Under the put method inside of RedisKeyValueAdapter.java we have the following code to handle @TimeToLive:
if (rdo.getTimeToLive() != null && rdo.getTimeToLive() > 0) {
connection.expire(objectKey, rdo.getTimeToLive());
// add phantom key so values can be restored
byte[] phantomKey = ByteUtils.concat(objectKey, BinaryKeyspaceIdentifier.PHANTOM_SUFFIX);
connection.del(phantomKey);
connection.hMSet(phantomKey, rdo.getBucket().rawMap());
connection.expire(phantomKey, rdo.getTimeToLive() + 300);
}
Consider adding an annotation/interface similar to @TimeToLive(such as @TimeToLiveDate or @TimeToExpire), where the developer can add a date to expire at rather than a long value. Additionally add another case to the conditional above to handle this new annotation/interface and use the connection.expireAt method
1 votes, 1 watchers
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.