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

conj keys always have -1 as expiration in redis 7 #475

Open
mariancraciun1983 opened this issue May 3, 2024 · 2 comments
Open

conj keys always have -1 as expiration in redis 7 #475

mariancraciun1983 opened this issue May 3, 2024 · 2 comments

Comments

@mariancraciun1983
Copy link

When using cacheops with Redis 7, the REDIS_4 code from cache_thing.lua is stripped away by the load_script and we’re left with this part that sets the conj values and expiration:

-- ---
redis.call('sadd', conj_key, key)
redis.call('expire', conj_key, timeout, 'gt')
-- ---
  • sadd will add/create the set with a default expiration of -1
  • expire uses gt option that won't have any effect if the expiration is-1.

The following code can be run to test this scenario:

import uuid
from cacheops.redis import redis_client
key = str(uuid.uuid4())
print(redis_client.ttl(key)) # -2 # missing
print(redis_client.execute_command('sadd', key, "value1")) # 1
print(redis_client.ttl(key)) # -1 # no expiration
print(redis_client.execute_command('expire', key, 60*60, 'gt')) # False # not changed
print(redis_client.ttl(key)) # -1 # no expiration
@anton-puzyr
Copy link

I'm experiencing the same issue with Redis 7.2. Any advices?

@Suor
Copy link
Owner

Suor commented May 6, 2024

I see, can anyone create a test for it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants