Skip to content

Commit

Permalink
Create an example of the Cache structure
Browse files Browse the repository at this point in the history
  • Loading branch information
mariari authored and m1dnight committed Nov 4, 2024
1 parent c4c620f commit 4b2034e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/ex_example/cache_result.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ defmodule ExExample.CacheResult do
I represent the result of a completed Example Computation
"""

field(:arguments, Macro.input() | nil, default: nil)
field(:source, Macro.input())
field(:source_name, atom())
field(:source_name, {module(), atom(), non_neg_integer()})
field(:result, term())
field(:pure, boolean())
end
Expand Down
16 changes: 16 additions & 0 deletions lib/ex_example/examples/e_cache_result.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
defmodule ExExample.Examples.ECacheResult do
alias ExExample.CacheResult

def trivial_definition() do
5
end

def trivial_cached_result do
%CacheResult{
source: [do: 5],
pure: true,
result: 5,
source_name: {__MODULE__, :trivial_definition, 0}
}
end
end

0 comments on commit 4b2034e

Please sign in to comment.