Skip to content

Commit ab418e4

Browse files
committed
docs(readme) clarify use-case for optional 'callback' in get()
1 parent 85e71c7 commit ab418e4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,10 @@ in the cache **and** no callback is provided, `get()` will return `nil, nil,
445445
with return values such as `nil, nil, 1`, where 1 signifies a **negative cached
446446
item** found in L1 (cached `nil`).
447447

448+
Not providing a `callback` function allows implementing cache lookup patterns
449+
that are guaranteed to be on-cpu for a more constant, smoother latency tail end
450+
(e.g. with values refreshed in background timers via `set()`).
451+
448452
```lua
449453
local value, err, hit_lvl = cache:get("key")
450454
if value == nil then

0 commit comments

Comments
 (0)