diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index 163fbdbca62e6132e33b496825e77084a3da5331..30985060fddb6f96c914e9847949674716ba44c3 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,3 +1,9 @@ +* Remove unused parameter `options = nil` for `#clear` of + `ActiveSupport::Cache::Strategy::LocalCache::LocalStore` and + `ActiveSupport::Cache::Strategy::LocalCache`. + + *Yosuke Kabuto* + * Fix `thread_mattr_accessor` subclass no longer overwrites parent. Assigning a value to a subclass using `thread_mattr_accessor` no diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index b0d371d91ebbf7763ce8a7403ec1ed48f52aace1..8ef91fa3f0b65ea548d537b57af1e307fb725e8c 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -464,7 +464,7 @@ def cleanup(options = nil) # The options hash is passed to the underlying cache implementation. # # All implementations may not support this method. - def clear(options = nil) + def clear raise NotImplementedError.new("#{self.class.name} does not support clear") end diff --git a/activesupport/lib/active_support/cache/file_store.rb b/activesupport/lib/active_support/cache/file_store.rb index 297c91303496d6cf1205e50c740b675706ead4e2..1971ff182ed592c7351ee9783f095e1b6dcbb2c3 100644 --- a/activesupport/lib/active_support/cache/file_store.rb +++ b/activesupport/lib/active_support/cache/file_store.rb @@ -27,7 +27,7 @@ def initialize(cache_path, options = nil) # 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. - def clear(options = nil) + def clear root_dirs = exclude_from(cache_path, EXCLUDED_DIRS + GITKEEP_FILES) FileUtils.rm_r(root_dirs.collect { |f| File.join(cache_path, f) }) rescue Errno::ENOENT diff --git a/activesupport/lib/active_support/cache/strategy/local_cache.rb b/activesupport/lib/active_support/cache/strategy/local_cache.rb index fbc28fedb16e522d000a8c66096dd50805903b8b..ec2e96a106384f82aaa51ae45eb51638373e87db 100644 --- a/activesupport/lib/active_support/cache/strategy/local_cache.rb +++ b/activesupport/lib/active_support/cache/strategy/local_cache.rb @@ -44,7 +44,7 @@ def synchronize # :nodoc: yield end - def clear(options = nil) + def clear @data.clear end @@ -78,9 +78,9 @@ def middleware local_cache_key) end - def clear(options = nil) # :nodoc: + def clear # :nodoc: return super unless cache = local_cache - cache.clear(options) + cache.clear super end