diff --git a/src/fd_sfc_cache.erl b/src/fd_sfc_cache.erl index dd629d3..462cb96 100644 --- a/src/fd_sfc_cache.erl +++ b/src/fd_sfc_cache.erl @@ -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() -> #{}.