-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding agent for caching recipient ids and extra tests for these addi…
…tional implementations
- Loading branch information
Matthew
committed
Aug 1, 2024
1 parent
7f78ff6
commit e15a45b
Showing
5 changed files
with
102 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
defmodule TurnJunebugExpressway.TurnAgent do | ||
use Agent | ||
|
||
def start_link(_) do | ||
Agent.start_link(fn -> %{} end, name: __MODULE__) | ||
end | ||
|
||
def put(key, value) do | ||
Agent.update(__MODULE__, &Map.put(&1, key, value)) | ||
end | ||
|
||
def get(key) do | ||
Agent.get(__MODULE__, &Map.get(&1, key)) | ||
end | ||
|
||
# TODO: Add a way to clear the cache after a set time | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters