lib/scrivito/cache/chainable.rb in scrivito_sdk-0.50.1 vs lib/scrivito/cache/chainable.rb in scrivito_sdk-0.60.0.rc1

- old
+ new

@@ -9,14 +9,16 @@ internal_write(transformed_key, value) end value end - def write(key, value, options = {}) + def write(key, value, expires_in = nil) transformed_key = transform_key(key) - next_store.write(transformed_key, value, options) if next_store - internal_write(transformed_key, value, options) + if forward_write?(key, value, expires_in) + next_store.write(transformed_key, value, expires_in) + end + internal_write(transformed_key, value, expires_in) end def fetch(key, &block) read(key) || block.call.tap { |value| write(key, value) } end @@ -38,15 +40,19 @@ def internal_read(key) raise NotImplementedError end - def internal_write(key, value, options = {}) + def internal_write(key, value, expires_in = nil) raise NotImplementedError end def transform_key(key) key + end + + def forward_write?(key, value, expires_in) + next_store.present? end end end end