runs
This commit is contained in:
@@ -21,12 +21,12 @@
|
||||
|
||||
-include("$zx_include/zx_logger.hrl").
|
||||
|
||||
-type entry() :: fd_sfc_entry:entry().
|
||||
-type maybe_entry() :: {found, fd_sfc_entry:entry()} | not_found.
|
||||
-type entry() :: fd_httpd_sfc_entry:entry().
|
||||
-type maybe_entry() :: {found, fd_httpd_sfc_entry:entry()} | not_found.
|
||||
|
||||
|
||||
-record(s, {base_path = base_path() :: file:filename(),
|
||||
cache = fd_sfc_cache:new(base_path()) :: fd_sfc_cache:cache(),
|
||||
cache = fd_httpd_sfc_cache:new(base_path()) :: fd_httpd_sfc_cache:cache(),
|
||||
auto_renew = 0_500 :: pos_integer()}).
|
||||
%-type state() :: #s{}.
|
||||
|
||||
@@ -62,14 +62,14 @@ start_link() ->
|
||||
%% gen_server callbacks
|
||||
|
||||
init(none) ->
|
||||
tell("starting fd_sfc"),
|
||||
tell("starting fd_httpd_sfc"),
|
||||
InitState = #s{},
|
||||
erlang:send_after(InitState#s.auto_renew, self(), auto_renew),
|
||||
{ok, InitState}.
|
||||
|
||||
|
||||
handle_call({query, Path}, _, State = #s{cache = Cache}) ->
|
||||
Reply = fd_sfc_cache:query(Path, Cache),
|
||||
Reply = fd_httpd_sfc_cache:query(Path, Cache),
|
||||
{reply, Reply, State};
|
||||
handle_call(Unexpected, From, State) ->
|
||||
tell("~tp: unexpected call from ~tp: ~tp", [?MODULE, Unexpected, From]),
|
||||
@@ -106,6 +106,6 @@ terminate(_, _) ->
|
||||
%%-----------------------------------------------------------------------------
|
||||
|
||||
i_renew(State = #s{base_path = BasePath}) ->
|
||||
NewCache = fd_sfc_cache:new(BasePath),
|
||||
NewCache = fd_httpd_sfc_cache:new(BasePath),
|
||||
NewState = State#s{cache = NewCache},
|
||||
NewState.
|
||||
|
||||
Reference in New Issue
Block a user