Skip to content

Does Update Reset the TTL? #450

Answered by tatsuya6502
ShiromMakkad asked this question in Q&A
Discussion options

You must be logged in to vote

Hi. Yes, and_try_compute_with and other insert 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, and last_accessed field is for the time to idle.

The "Key" box and "Value" boxes (including the last_modified field) are updated when an insert like method is called, so you do not need to call run_pending_tasks. The boxes on the bottom will be updated by an implicit or explicit call on run_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:

  1. Remove expired entr…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ShiromMakkad
Comment options

Answer selected by ShiromMakkad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants