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

adding the hmset with ttl #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

adding the hmset with ttl #51

wants to merge 1 commit into from

Conversation

dilwaria
Copy link

No description provided.

@ghost
Copy link

ghost commented Jan 5, 2021

Bump cauldron version in setup.py file

def hmset_with_ttl(cls,field,value,ttl,namespace =''):
with (yield from cls.get_pool()) as redis:
yield from redis.hmset(namespace, field, value)
redis.expire(namespace,ttl)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will reset the expiry to ttl seconds each time this method is called. So if within "ttl" seconds this method is called again and again the key will never expire. But in our use case key must expire after "ttl" seconds from the time it was first created.

Also, need to check if expire() is a coroutine or not. If it's a coroutine "yield from" is missing here.

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

Successfully merging this pull request may close these issues.

1 participant