Does Update Reset the TTL? #450
-
Hello, I'm wondering if updating the value inside the cache will reset the TTL. I'm specifically wondering about |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I wrote a test and confirmed that |
Beta Was this translation helpful? Give feedback.
-
Hi. Yes, The following diagram (from #72) is a bit outdated, but The "Key" box and "Value" boxes (including the The tasks ran by For example, it removes expired entries:
And you would not have to call
(I should put the info to a better place in the document, but I have not found the time to do so yet.) |
Beta Was this translation helpful? Give feedback.
Hi. Yes,
and_try_compute_with
and otherinsert
like methods update the TTL and time to idle timers.The following diagram (from #72) is a bit outdated, but
last_modified
field in the middle right box is for the TTL, andlast_accessed
field is for the time to idle.The "Key" box and "Value" boxes (including the
last_modified
field) are updated when aninsert
like method is called, so you do not need to callrun_pending_tasks
. The boxes on the bottom will be updated by an implicit or explicit call onrun_pending_tasks
. They are used to evict entries when the cache is full.The tasks ran by
run_pending_tasks
are documented here.For example, it removes expired entries: