mirror of
https://github.com/valitydev/cache.git
synced 2024-11-06 01:45:19 +00:00
support ananymous cache instance
This commit is contained in:
parent
f76a6e2276
commit
559070765b
@ -1,7 +1,7 @@
|
||||
{application, cache,
|
||||
[
|
||||
{description, "in-memory cache"},
|
||||
{vsn, "0.11.0"},
|
||||
{vsn, "0.11.1"},
|
||||
{modules, [
|
||||
cache,
|
||||
cache_bucket,
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
-export([start/0]).
|
||||
-export([
|
||||
start_link/1,
|
||||
start_link/2,
|
||||
drop/1,
|
||||
purge/1,
|
||||
@ -97,8 +98,12 @@ start() ->
|
||||
%% {quota, integer()} - frequency of quota check in seconds
|
||||
%% {stats, function() | {Mod, Fun}} - cache statistic aggregate functor
|
||||
%% {heir, atom() | pid()} - heir of evicted cache segments
|
||||
-spec(start_link/1 :: (list()) -> {ok, pid()} | {error, any()}).
|
||||
-spec(start_link/2 :: (name(), list()) -> {ok, pid()} | {error, any()}).
|
||||
|
||||
start_link(Opts) ->
|
||||
cache_bucket:start_link(Opts).
|
||||
|
||||
start_link(Cache, Opts) ->
|
||||
cache_bucket:start_link(Cache, Opts).
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
-include("cache.hrl").
|
||||
|
||||
-export([
|
||||
start_link/1,
|
||||
start_link/2,
|
||||
init/1,
|
||||
terminate/2,
|
||||
@ -65,6 +66,9 @@
|
||||
%%%
|
||||
%%%----------------------------------------------------------------------------
|
||||
|
||||
start_link(Opts) ->
|
||||
gen_server:start_link(?MODULE, [undefined, Opts], []).
|
||||
|
||||
start_link({global, Name}, Opts) ->
|
||||
gen_server:start_link({global, Name}, ?MODULE, [Name, Opts], []);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user