Skip to content

Commit 5f67056

Browse files
committed
add documentation for the fetch function
1 parent 07e00e8 commit 5f67056

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/scenic/cache.ex

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,19 @@ defmodule Scenic.Cache do
9090
reraise(other, __STACKTRACE__)
9191
end
9292

93+
@doc """
94+
This function works the same as the `get` function. That is it accepts a key paramter and returns a ok/error tuple i
95+
making this function ideal if you need to pattern match on the result of getting from the cache
96+
97+
## Examples
98+
iex> Scenic.Cache.fetch("test_key")
99+
{:error, :not_found}
100+
101+
iex> :ets.insert(:scenic_cache_key_table, {"test_key", 1, :test_data})
102+
...> true
103+
...> Scenic.Cache.fetch("test_key")
104+
{:ok, :test_data}
105+
"""
93106
def fetch(key)
94107

95108
def fetch(key) do

0 commit comments

Comments
 (0)