Skip to content

Commit 2bae94f

Browse files
authored
Update fetch docs to explain existing nil value scenario (#424)
Otherwise it's not documented anywhere that if the key exists but the value is nil, it won't return the cache value but will instead run the fallback function.
1 parent b1aaa42 commit 2bae94f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lib/cachex.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,9 @@ defmodule Cachex do
565565
Fetches an entry from a cache, generating a value on cache miss.
566566
567567
If the entry requested is found in the cache, this function will
568-
operate in the same way as `get/3`. If the entry is not contained
569-
in the cache, the provided fallback function will be executed.
568+
operate in the same way as `get/3`. If the key does not exist
569+
in the cache, or if it does exist but the value is nil, then the
570+
provided fallback function will be executed.
570571
571572
A fallback function is a function used to lazily generate a value
572573
to place inside a cache on miss. Consider it a way to achieve the

0 commit comments

Comments
 (0)