diff --git a/src/cache.app.src b/src/cache.app.src index fc5b0cb..f4be8a7 100644 --- a/src/cache.app.src +++ b/src/cache.app.src @@ -1,7 +1,7 @@ {application, cache, [ {description, "in-memory cache"}, - {vsn, "0.11.0"}, + {vsn, "0.11.1"}, {modules, [ cache, cache_bucket, diff --git a/src/cache.erl b/src/cache.erl index b1d381f..7a3f87d 100644 --- a/src/cache.erl +++ b/src/cache.erl @@ -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). diff --git a/src/cache_bucket.erl b/src/cache_bucket.erl index f5c0973..7a32ee5 100644 --- a/src/cache_bucket.erl +++ b/src/cache_bucket.erl @@ -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], []);