support ananymous cache instance

This commit is contained in:
Dmitry Kolesnikov 2014-07-12 19:59:30 +03:00
parent f76a6e2276
commit 559070765b
3 changed files with 10 additions and 1 deletions

View File

@ -1,7 +1,7 @@
{application, cache,
[
{description, "in-memory cache"},
{vsn, "0.11.0"},
{vsn, "0.11.1"},
{modules, [
cache,
cache_bucket,

View File

@ -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).

View File

@ -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], []);