Skip to content
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

RedisCache should not expire known keys in case ttl of element is not set. [DATAREDIS-402] #977

Closed
spring-projects-issues opened this issue Jun 1, 2015 · 1 comment
Assignees
Labels
in: core Issues in core support type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link

Christoph Strobl opened DATAREDIS-402 and commented

We need to check if an element is eternal when setting TTL for the set of known keys. Otherwise we'd expire the_ZSET_ immediately which breaks Cache.clear since we do not know about the eternal key any more.

    protected void maintainKnownKeys(RedisCacheElement element, RedisConnection connection) {

			if (!element.hasKeyPrefix()) {
				connection.zAdd(cacheMetadata.getSetOfKnownKeysKey(), 0, element.getKeyBytes());
				if (!element.isEternal()) {
					connection.expire(cacheMetadata.getSetOfKnownKeysKey(), element.getTimeToLive());
				}
			}
		}

Affects: 1.5 GA (Fowler)

Referenced from: pull request #141

Backported to: 1.5.1 (Fowler SR1)

@spring-projects-issues
Copy link
Author

Thomas Darimont commented

LGTM, cp'ed into master and 1.5.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core support type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants