I have a Micronaut cache in Redis configured like this:
redis:
uri: ${REDIS_URL:`redis://localhost`}
caches:
kyc-fenergo-service-token:
expire-after-write: 14m
I have a method annotated like this: @Cacheable(value = "kyc-fenergo-service-token")
After the first call, the value is cached as expected, but it never expires. Any idea why this is the case?
Check your Redis server configuration to ensure that key expiration is enabled. Look for the notify-keyspace-events
configuration directive in your Redis configuration file (redis.conf
) and make sure it includes the Ex flag. For example, notify-keyspace-events Ex
.