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 should maintain TTL #339

Closed
zulander1 opened this issue Mar 25, 2023 · 2 comments
Closed

Update should maintain TTL #339

zulander1 opened this issue Mar 25, 2023 · 2 comments

Comments

@zulander1
Copy link
Contributor

When adding an object with a TTL then updating the object causes the TTL to disappear. I think we should change this behaviors so the object TTL is maintained during the update.

        var james = new Customer
        {
            Id = 1,
            FirstName = "James",
            LastName = "Bond",
            Email = "[email protected]",
            Age = 68
        };

        // Insert Object
        customers.Insert(james, TimeSpan.FromMinutes(1));

        james.FirstName = "James1";
        customers.Update(james);

This results in:


1679760370.742888 [0 172.17.0.1:37810] "JSON.SET" "Redis.OM.Test.ConsoleApp.Program+Customer:1" "." "{\"Id\":1,\"FirstName\":\"James\",\"LastName\":\"Bond\",\"Email\":\"[email protected]\",\"Age\":68,\"Home\":\"0,0\"}"
1679760370.742923 [0 172.17.0.1:37810] "SELECT" "0"
1679760370.742932 [0 172.17.0.1:37810] "PEXPIRE" "Redis.OM.Test.ConsoleApp.Program+Customer:1" "60000"
1679760370.742942 [0 172.17.0.1:37810] "SELECT" "0"
1679760370.742946 [0 172.17.0.1:37810] "EXEC"
1679760370.807542 [0 172.17.0.1:37810] "SELECT" "0"
1679760370.807566 [0 172.17.0.1:37810] "SCRIPT" "LOAD" "\\r\\nredis.call('UNLINK', KEYS[1])\\r\\nredis.call('JSON.SET', KEYS[1], '.', ARGV[1])\\r\\nreturn 0\\r\\n"
1679760370.810061 [0 172.17.0.1:37810] "SELECT" "0"
1679760370.810109 [0 172.17.0.1:37810] "EVALSHA" "662066e89db469f8f9a8a7409b603b218bc4eac8" "1" "Redis.OM.Test.ConsoleApp.Program+Customer:1" "{\"Id\":1,\"FirstName\":\"James1\",\"LastName\":\"Bond\",\"Email\":\"[email protected]\",\"Age\":68,\"Home\":\"0,0\"}"
1679760370.810221 [0 lua] "UNLINK" "Redis.OM.Test.ConsoleApp.Program+Customer:1"
1679760370.810365 [0 lua] "JSON.SET" "Redis.OM.Test.ConsoleApp.Program+Customer:1" "." "{\"Id\":1,\"FirstName\":\"James1\",\"LastName\":\"Bond\",\"Email\":\"[email protected]\",\"Age\":68,\"Home\":\"0,0\"}"
@zulander1
Copy link
Contributor Author

zulander1 commented Mar 25, 2023

I think we should combine #251 and #216 to this:

Update (T item) - update and maintain the current TTL
Update (T item, Timespan ttl) - update and when timespan is 0 then remove any TTL otherwise update to new TTL

looking at the code, its already implemented, we just implement it in the update portion !

@slorello89
Copy link
Member

Completed in #340

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

2 participants