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

Methods that set TTL (TimeSpan) need the ability to remove TTL #251

Open
VagyokC4 opened this issue Nov 3, 2022 · 3 comments
Open

Methods that set TTL (TimeSpan) need the ability to remove TTL #251

VagyokC4 opened this issue Nov 3, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@VagyokC4
Copy link

VagyokC4 commented Nov 3, 2022

@slorello89 When saving a record with a TTL InsertAsync(), we should have a way to write the record without a TTL, in the case we want to persist the record without TTL.

Currently, if the record was initially saved with TTL, saving again without TTL does not adjust the previously set TTL, and the record disappears after some time.

Can I suggest making the TimeSpan nullable, so if we save with a NULL TimeSpan, then the result is the TTL is removed (if one exists)?

@slorello89 slorello89 added the enhancement New feature or request label Nov 3, 2022
@slorello89
Copy link
Member

Good point - this would definitely be nice to have. In the interim you can use PERSIST and EXPIRE/PEXIRE commands directly to influence the expiry of the object you want to update. I almost wonder if binding an expiration to the model might even make sense at some point down the line?

@VagyokC4
Copy link
Author

VagyokC4 commented Nov 4, 2022

I almost wonder if binding an expiration to the model might even make sense at some point down the line?

I can see some benefit of expressing it on the model. I've def. run into some use cases where the record is always temporary. If it was on the model, the same pattern to short-circuit it? Save passing NULL for the TimeSpan property?

@VagyokC4
Copy link
Author

VagyokC4 commented Nov 9, 2023

I can see some benefit of expressing it on the model. I've def. run into some use cases where the record is always temporary. If it was on the model, the same pattern to short-circuit it? Save passing NULL for the TimeSpan property?

Hi @slorello89,

Can we get some attribute support for default TTL? My use case is that there are some records that I want to automatically set a TTL on and I would like to define that on the model itself via an attribute, inline with the current configuration patterns.

Then when writing the record, if the TTL is set on the attribute, that TTL is used when making the write call. Something tells me we would want a way to bypass the attribute ttl as well as there may be times when we want to ignore the attribute TTL.

Your thoughts?

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

No branches or pull requests

2 participants