-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Could data created by @Indexed automatically expired by @TimeToLive? #3001
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The indexes you refer to were created by Redis Repositories. Redis only supports top-level key TTLs (and since Redis 7.4 also Hash-field TTL). Any entries within a secondary index (set, geoset) cannot be expired by Redis itself. To address this shortcoming, Spring Data Redis uses Pub/Sub listeners for keyspace events to remove expired elements from secondary indexes. That also means, if your application isn't running or has been disconnected from Redis, the secondary index cleanup isn't performed. |
Does that mean that if I want to delete secondary index data, I need to implement the specific keyspace expire event listener myself? |
No, configuring your application with |
thanks! |
Sorry for bothering, the fact that enabling the keyspace event listener will do its job, but it won't work on GCP MemoryStore as the CONFIG command is forbidden. |
When data in redis expired by @timetolive, the secondary index data created by @indexed never expired.
Is it possible to set expire time of secondary index data with the same value as @timetolive?
The text was updated successfully, but these errors were encountered: