add query function
This commit is contained in:
parent
8b938fdd42
commit
f3a107111f
@ -7,6 +7,7 @@
|
||||
]).
|
||||
|
||||
-export([
|
||||
query/2,
|
||||
new/0, new/1
|
||||
]).
|
||||
|
||||
@ -15,6 +16,20 @@
|
||||
-type cache() :: #{HttpPath :: binary() := Entry :: fd_sfc_entry:entry()}.
|
||||
|
||||
|
||||
-spec query(HttpPath, Cache) -> Result
|
||||
when HttpPath :: binary(),
|
||||
Cache :: cache(),
|
||||
Result :: {found, Entry}
|
||||
| not_found,
|
||||
Entry :: fd_sfc_entry:entry().
|
||||
|
||||
query(HttpPath, Cache) ->
|
||||
case maps:find(HttpPath, Cache) of
|
||||
{ok, Entry} -> {found, Entry};
|
||||
error -> not_found
|
||||
end.
|
||||
|
||||
|
||||
-spec new() -> cache().
|
||||
new() -> #{}.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user