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

Update TTL on SaveAsync. #216

Closed
a-solonovich opened this issue Sep 28, 2022 · 3 comments
Closed

Update TTL on SaveAsync. #216

a-solonovich opened this issue Sep 28, 2022 · 3 comments
Assignees
Labels

Comments

@a-solonovich
Copy link

It would be great to be able to update Redis TTL on IRedisCollection.SaveAsync().
It is a quite common scenario when you want your object to be in the cache with sliding lifetime if it is being updated.
As of now you either have to use SetAsync(object, Timespan) or HSetAsync(object, TimeSpan, KeyValuePair<string, string>) of RedisConnectionProvider.Connection. The first one lacks an ability to just update the things that need to be changed, the syntax of the latter one is somewhat cumbersome and you have to populate the key separately.

Would be great to have the behaviour similar to InsertAsync(T item, TimeSpan timeSpan) with some additional overrides:
IRedisCollection.SaveAsync(Timespan ttl)
RedisConnectionProvider.Connection.UpdateAsync(T item, Timespan ttl)

@slorello89
Copy link
Member

I'm skeptical about moving this behavior to Save/SaveAsync the reason for that is that Save/SaveAsync is meant to operate on everything enumerated in the collection, I think that could get real quirky real fast. Probably adding this to Update/UpdateAsync could make a lot of sense. Will look into it.

@berviantoleo
Copy link
Contributor

Probably adding this to Update/UpdateAsync could make a lot of sense. Will look into it.

Agreed with this. Currently, I want to update the TTL through RedisCollection, would be great if we have it in Update/UpdateAsync or have a binding in the model #251 (comment).

@slorello89
Copy link
Member

Yeah I think keeping it to Update ought to be sufficent - which we do now :)

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

No branches or pull requests

5 participants