Commit 0c44c05b authored by David H. Wilkins's avatar David H. Wilkins

Code review changes and add changelog

- move key assignment to abobve the cache lifetime check

- add changelog
parent eec780c9
...@@ -129,16 +129,16 @@ module ReactiveCaching ...@@ -129,16 +129,16 @@ module ReactiveCaching
def exclusively_update_reactive_cache!(*args) def exclusively_update_reactive_cache!(*args)
locking_reactive_cache(*args) do locking_reactive_cache(*args) do
key = full_reactive_cache_key(*args)
if within_reactive_cache_lifetime?(*args) if within_reactive_cache_lifetime?(*args)
enqueuing_update(*args) do enqueuing_update(*args) do
key = full_reactive_cache_key(*args)
new_value = calculate_reactive_cache(*args) new_value = calculate_reactive_cache(*args)
old_value = Rails.cache.read(key) old_value = Rails.cache.read(key)
Rails.cache.write(key, new_value) Rails.cache.write(key, new_value)
reactive_cache_updated(*args) if new_value != old_value reactive_cache_updated(*args) if new_value != old_value
end end
else else
Rails.cache.delete(full_reactive_cache_key(*args)) Rails.cache.delete(key)
end end
end end
end end
......
---
title: reactive-caching-self-cleanup
merge_request: 20111
author:
type: performance
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