diff options
Diffstat (limited to 'shard/lib/app/blockstore.ex')
-rw-r--r-- | shard/lib/app/blockstore.ex | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/shard/lib/app/blockstore.ex b/shard/lib/app/blockstore.ex index f1140b2..077235a 100644 --- a/shard/lib/app/blockstore.ex +++ b/shard/lib/app/blockstore.ex @@ -43,6 +43,7 @@ defmodule SApp.BlockStore do {:ok, %State{shard_id: shard_id, path: path, store: store, reqs: %{}, retries: %{}}} end + def handle_call({:get, key, prefer_ask}, from, state) do case :ets.lookup state.store, key do [{_, _, v}] -> @@ -215,10 +216,9 @@ defmodule SApp.BlockStore do def handle_info(:clean_cache, state) do currtime = System.os_time :seconds - cache_cleanup_1 = [ {{:_, {:cached, :'$1'}, :_}, [{:<, :'$1', currtime}], [:'$1']} ] - cache_cleanup_2 = [ {{:_, {:cached, :'$1'}}, [{:<, :'$1', currtime}], [:'$1']} ] - :ets.select_delete(state.store, cache_cleanup_1) - :ets.select_delete(state.store, cache_cleanup_2) + cache_cleanup = [ {{:_, {:cached, :'$1'}, :_}, [{:<, :'$1', currtime}], [true]}, + {{:_, {:cached, :'$1'}}, [{:<, :'$1', currtime}], [true]} ] + :ets.select_delete(state.store, cache_cleanup) Process.send_after(self(), :clean_cache, @clean_cache_every * 1000) {:noreply, state} |