问题
I found the following question (Spring Redis - Indexes not deleted after main entry expires) about a problem with expiration of indexes in Redis.
The problem is that the main and :phantom
entries expire and are being deleted correctly, but the corresponding :idx
entries survive orphaned in Redis.
One of the proposed solutions was to enable KeyspaceEvents, so that Redis automatically removes indexes of expired entries during the cleanup job.
Unfortunately this solution will not work for our Spring Boot application, as we are using Redis Enterprise as a provided service inside a cloud environment, which does not allow us to make any configuration changes (CONFIG
command is disabled).
Here what I tried:
@Configuration
@EnableRedisRepositories(enableKeyspaceEvents = RedisKeyValueAdapter.EnableKeyspaceEvents.ON_STARTUP)
public class RedisConfiguration {...}
Edit:
I thought this was working for my local Redis docker image, but I was wrong! And on our provided Redis (Enterprise) service it can't even be setup with the following message:Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR unknown command 'CONFIG'...
Can anybody give me a hint on how to get the indexes deleted?
We currently do not have many :idx
entries, but they must/should be deleted together with the :phantom
entry, to avoid keeping any 'orphaned' entries.
Thanks in advance.
来源:https://stackoverflow.com/questions/48379229/redis-expired-indexes-are-not-deleted