Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 22cbbd2f73
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (21 sloc) 0.778 kB
-module(boss_cache).
-export([start/0, start/1]).
-export([stop/0]).
-export([get/2, set/4, delete/2]).
-define(POOLNAME, boss_cache_pool).
start() ->
Adapter = boss_cache_adapter_memcached_bin,
start([{adapter, Adapter}, {cache_servers, [{"127.0.0.1", 11211, 1}]}]).
start(Options) ->
AdapterName = proplists:get_value(adapter, Options, memcached_bin),
Adapter = list_to_atom(lists:concat(["boss_cache_adapter_", AdapterName])),
Adapter:start(Options),
boss_cache_sup:start_link(Options).
stop() ->
ok.
set(Prefix, Key, Val, TTL) ->
boss_pool:call(?POOLNAME, {set, Prefix, Key, Val, TTL}).
get(Prefix, Key) ->
boss_pool:call(?POOLNAME, {get, Prefix, Key}).
delete(Prefix, Key) ->
boss_pool:call(?POOLNAME, {delete, Prefix, Key}).
Jump to Line
Something went wrong with that request. Please try again.