diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..fd853cf --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +# +# Leo Cache +# +language: erlang +script: "make && make eunit" +notifications: + email: false +otp_release: + - 18.3 + - 19.3 + - 20.0 +before_install: + - sudo apt-get update -qq + - sudo apt-get install -y check diff --git a/src/leo_cache_api.erl b/src/leo_cache_api.erl index 7023f99..df6547a 100644 --- a/src/leo_cache_api.erl +++ b/src/leo_cache_api.erl @@ -37,7 +37,7 @@ -export([start/0, start/1, stop/0, get_filepath/1, get_ref/1, get/1, get/2, put/2, put/3, put_begin_tran/2, put_end_tran/5, - delete/1, stats/0]). + delete/1, stats/0, is_disc_cache_active/0]). %%----------------------------------------------------------------------- %% External API @@ -361,3 +361,15 @@ stats() -> {ok, #stats{}} end. + +%% @doc Return if Disk Cache is active +%% +-spec(is_disc_cache_active() -> + boolean()). +is_disc_cache_active() -> + case ets:lookup(?ETS_CACHE_SERVER_INFO, 0) of + [{_, Item}|_] -> + Item#cache_server.disc_cache_active; + _ -> + false + end.