diff options
Diffstat (limited to 'activesupport')
5 files changed, 35 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/cache/file_store.rb b/activesupport/lib/active_support/cache/file_store.rb index 04c54c30d0..b17f0a4a4a 100644 --- a/activesupport/lib/active_support/cache/file_store.rb +++ b/activesupport/lib/active_support/cache/file_store.rb @@ -26,6 +26,13 @@ module ActiveSupport @cache_path = cache_path.to_s end + # Advertise that this cache store can be used + # with "recyclable cache keys" otherwise known + # as cache versioning. + def supports_in_cache_versioning? + true + end + # Deletes all items from the cache. In this case it deletes all the entries in the specified # file store directory except for .keep or .gitkeep. Be careful which directory is specified in your # config file when using +FileStore+ because everything in that directory will be deleted. diff --git a/activesupport/lib/active_support/cache/mem_cache_store.rb b/activesupport/lib/active_support/cache/mem_cache_store.rb index 2840781dde..f235f05d6c 100644 --- a/activesupport/lib/active_support/cache/mem_cache_store.rb +++ b/activesupport/lib/active_support/cache/mem_cache_store.rb @@ -47,6 +47,13 @@ module ActiveSupport end end + # Advertise that this cache store can be used + # with "recyclable cache keys" otherwise known + # as cache versioning. + def supports_in_cache_versioning? + true + end + prepend Strategy::LocalCache prepend LocalCacheWithRaw diff --git a/activesupport/lib/active_support/cache/memory_store.rb b/activesupport/lib/active_support/cache/memory_store.rb index 564ac17241..32530fa2a9 100644 --- a/activesupport/lib/active_support/cache/memory_store.rb +++ b/activesupport/lib/active_support/cache/memory_store.rb @@ -30,6 +30,13 @@ module ActiveSupport @pruning = false end + # Advertise that this cache store can be used + # with "recyclable cache keys" otherwise known + # as cache versioning. + def supports_in_cache_versioning? + true + end + # Delete all data stored in a given cache store. def clear(options = nil) synchronize do diff --git a/activesupport/lib/active_support/cache/null_store.rb b/activesupport/lib/active_support/cache/null_store.rb index 1a5983db43..405d485671 100644 --- a/activesupport/lib/active_support/cache/null_store.rb +++ b/activesupport/lib/active_support/cache/null_store.rb @@ -12,6 +12,13 @@ module ActiveSupport class NullStore < Store prepend Strategy::LocalCache + # Advertise that this cache store can be used + # with "recyclable cache keys" otherwise known + # as cache versioning. + def supports_in_cache_versioning? + true + end + def clear(options = nil) end diff --git a/activesupport/lib/active_support/cache/redis_cache_store.rb b/activesupport/lib/active_support/cache/redis_cache_store.rb index 5737450b4a..4cee774908 100644 --- a/activesupport/lib/active_support/cache/redis_cache_store.rb +++ b/activesupport/lib/active_support/cache/redis_cache_store.rb @@ -66,6 +66,13 @@ module ActiveSupport SCAN_BATCH_SIZE = 1000 private_constant :SCAN_BATCH_SIZE + # Advertise that this cache store can be used + # with "recyclable cache keys" otherwise known + # as cache versioning. + def supports_in_cache_versioning? + true + end + # Support raw values in the local cache strategy. module LocalCacheWithRaw # :nodoc: private |