couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [04/10] ddoc-cache commit: updated refs/heads/master to 4ffc6b0
Date Thu, 28 Aug 2014 12:17:46 GMT
Define a macro for the LRU cache name


Project: http://git-wip-us.apache.org/repos/asf/couchdb-ddoc-cache/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-ddoc-cache/commit/4b1c758b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-ddoc-cache/tree/4b1c758b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-ddoc-cache/diff/4b1c758b

Branch: refs/heads/master
Commit: 4b1c758b58da9615eb10320add30a4628002b23f
Parents: 72f6af5
Author: Brian Mitchell <brian@cloudant.com>
Authored: Fri Oct 11 11:04:00 2013 -0400
Committer: Robert Newson <rnewson@apache.org>
Committed: Tue Jul 29 11:50:47 2014 +0100

----------------------------------------------------------------------
 src/ddoc_cache_opener.erl | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-ddoc-cache/blob/4b1c758b/src/ddoc_cache_opener.erl
----------------------------------------------------------------------
diff --git a/src/ddoc_cache_opener.erl b/src/ddoc_cache_opener.erl
index e949f60..258b5fc 100644
--- a/src/ddoc_cache_opener.erl
+++ b/src/ddoc_cache_opener.erl
@@ -13,10 +13,8 @@
 -module(ddoc_cache_opener).
 -behaviour(gen_server).
 
-
 -include_lib("mem3/include/mem3.hrl").
 
-
 -export([
     start_link/0
 ]).
@@ -41,6 +39,7 @@
 ]).
 
 
+-define(CACHE, ddoc_cache_lru).
 -define(OPENING, ddoc_cache_opening).
 
 -type dbname() :: iodata().
@@ -120,9 +119,9 @@ handle_cast({do_evict, DbName}, St) ->
     handle_cast({do_evict, DbName, DDocIds}, St);
 
 handle_cast({do_evict, DbName, DDocIds}, St) ->
-    ets_lru:remove(ddoc_cache_lru, {DbName, validation_funs}),
+    ets_lru:remove(?CACHE, {DbName, validation_funs}),
     lists:foreach(fun(DDocId) ->
-        ets_lru:remove(ddoc_cache_lru, {DbName, DDocId})
+        ets_lru:remove(?CACHE, {DbName, DDocId})
     end, DDocIds),
     {noreply, St};
 
@@ -181,12 +180,12 @@ open_ddoc({DbName, validation_funs}=Key) ->
             Fun -> [Fun]
         end
     end, DDocs),
-    ok = ets_lru:insert(ddoc_cache_lru, {DbName, validation_funs}, Funs),
+    ok = ets_lru:insert(?CACHE, {DbName, validation_funs}, Funs),
     exit({open_ok, Key, {ok, Funs}});
 open_ddoc({DbName, DDocId}=Key) ->
     try fabric:open_doc(DbName, DDocId, [ejson_body]) of
         {ok, Doc} ->
-            ok = ets_lru:insert(ddoc_cache_lru, {DbName, DDocId}, Doc),
+            ok = ets_lru:insert(?CACHE, {DbName, DDocId}, Doc),
             exit({open_ok, Key, {ok, Doc}});
         Else ->
             exit({open_ok, Key, Else})


Mime
View raw message