spring-projects / spring-projects/spring-data-redis
Allow using double-colon as keyspace name through `@RedisHash(value = …)`
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.9k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
This may be related to/a duplicate of #1326, but that issue was closed back in 2018.
For this Kotlin example, say I have:
@RedishHash(value = "keysubname", timeToLive = 10L)
data class KeySubname(
@Id
val id: Long
@Indexed
val ext_id: Long
)
And that keyspace events are enabled in the Spring application:
@EnableRedisRepositories(enableKeyspaceEvents = RedisKeyValueAdapter.EnableKeyspaceEvents.ON_STARTUP)
After saving the hash, it and its index, secondary index, and lookup hashmap are deleted after 10 seconds. This is expected behavior.
However, if I add a colon to the hash's name (and make no other changes):
@RedishHash(value = "key:subname", timeToLive = 10L)
data class KeySubname(
@Id
val id: Long
@Indexed
val ext_id: Long
)
Then the secondary index and lookup hashmap are not deleted after 10 seconds, leaving a permanent record in the redis db of a hash that no longer exists.
Hopefully this issue can be fixed soon. Please let me know how else I can help.
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.
Research direction
Start by reproducing the Kotlin example with @RedisHash, @Indexed, and EnableRedisRepositories(enableKeyspaceEvents = ON_STARTUP) using both keyspace names. Observe the hash, secondary index, and lookup hashmap after the 10-second TTL; done means all related records are removed when the name contains a double colon.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, redis
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100