Skip to content

Commit 7dd9fa7

Browse files
Address feedback (thanks HansGlimmerfors)
1 parent fec1c65 commit 7dd9fa7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/cachex.ex

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -566,25 +566,25 @@ defmodule Cachex do
566566
to lazily generate a value on cache miss. Conceptually similar to a
567567
read-through cache.
568568
569-
Cachex will store any value `fallback` returns. If you want more
569+
Normally Cache stores the value returned by `fallback`. If you want more
570570
control, return a Tuple like `{:commit, value}` or `{:ignore, value}`.
571-
Passing `:ignore` instructs Cachex to not store the value.
571+
Passing `:ignore` instructs Cachex not to store the value.
572572
573573
You may provide a third element in a `:commit` Tuple, to specify options the
574574
same as you would in `put/4`.
575575
576+
`fallback` optionally takes argument `key`.
577+
576578
Multiple calls to `fetch/4` with the same key while the `fallback` is running
577579
will wait on the lazy evaluation to complete. Multiple instances of
578580
`fallback` will never run concurrently for a given key.
579581
580-
`fallback` optionally receives `key` as an argument.
581-
582582
## Examples
583583
584-
iex> Cachex.fetch(:my_cache, "key", fn -> "default" end)
585-
{ :commit, "default" }
586-
iex> Cachex.fetch(:my_cache, "key", fn -> "default" end)
587-
{ :ok, "default" }
584+
iex> Cachex.fetch(:my_cache, "key", fn -> "value" end)
585+
{ :commit, "value" }
586+
iex> Cachex.fetch(:my_cache, "key", fn -> "value" end)
587+
{ :ok, "value" }
588588
589589
iex> Cachex.fetch(:my_cache, "missing_key", fn(key) ->
590590
...> { :ignore, String.reverse(key) }

0 commit comments

Comments
 (0)