Commit 2d98e2a3 authored by Ryan Cobb's avatar Ryan Cobb

Add without_reactive_cache method

parent be6c72dc
......@@ -106,8 +106,6 @@ module ReactiveCaching
end
def with_reactive_cache(*args, &blk)
return reactive_cache_pry(*args, &blk) if ENV['REACTIVE_CACHE_PRY'] == 'true'
unless within_reactive_cache_lifetime?(*args)
refresh_reactive_cache!(*args)
return
......@@ -124,6 +122,12 @@ module ReactiveCaching
end
end
# This method is used for debugging purposes and should not be used otherwise.
def without_reactive_cache(*args, &blk)
data = self.class.reactive_cache_worker_finder.call(id, *args).calculate_reactive_cache(*args)
yield data
end
def clear_reactive_cache!(*args)
Rails.cache.delete(full_reactive_cache_key(*args))
Rails.cache.delete(alive_reactive_cache_key(*args))
......@@ -148,14 +152,6 @@ module ReactiveCaching
private
def reactive_cache_pry(*args, &blk)
data = Rails.cache.fetch(full_reactive_cache_key(*args), expires_in: 5.seconds) do
self.class.reactive_cache_worker_finder.call(id, *args).calculate_reactive_cache(*args)
end
yield data
end
def refresh_reactive_cache!(*args)
clear_reactive_cache!(*args)
keep_alive_reactive_cache!(*args)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment