@@ -68,14 +68,13 @@ defmodule Scenic.Cache do
68
68
function returns the term stored in the cache with the using the provided key
69
69
70
70
## Examples
71
+ iex> Scenic.Cache.get("test_key")
72
+ nil
71
73
72
- iex> Scenic.Cache.get("test_key")
73
- nil
74
-
75
- iex> :ets.insert(:scenic_cache_key_table, {"test_key", 1, :test_data})
76
- ...> true
77
- ...> Scenic.Cache.get("test_key")
78
- :test_data
74
+ iex> :ets.insert(:scenic_cache_key_table, {"test_key", 1, :test_data})
75
+ ...> true
76
+ ...> Scenic.Cache.get("test_key")
77
+ :test_data
79
78
"""
80
79
@ spec get ( term ( ) , term ( ) ) :: term ( ) | nil
81
80
def get ( key , default \\ nil )
@@ -95,13 +94,13 @@ defmodule Scenic.Cache do
95
94
making this function ideal if you need to pattern match on the result of getting from the cache
96
95
97
96
## Examples
98
- iex> Scenic.Cache.fetch("test_key")
99
- {:error, :not_found}
97
+ iex> Scenic.Cache.fetch("test_key")
98
+ {:error, :not_found}
100
99
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}
100
+ iex> :ets.insert(:scenic_cache_key_table, {"test_key", 1, :test_data})
101
+ ...> true
102
+ ...> Scenic.Cache.fetch("test_key")
103
+ {:ok, :test_data}
105
104
"""
106
105
def fetch ( key )
107
106
0 commit comments