diff options
Diffstat (limited to 'activesupport/lib/active_support/cache')
4 files changed, 9 insertions, 9 deletions
diff --git a/activesupport/lib/active_support/cache/file_store.rb b/activesupport/lib/active_support/cache/file_store.rb index 1132425526..297c913034 100644 --- a/activesupport/lib/active_support/cache/file_store.rb +++ b/activesupport/lib/active_support/cache/file_store.rb @@ -29,7 +29,7 @@ module ActiveSupport # config file when using +FileStore+ because everything in that directory will be deleted. def clear(options = nil) root_dirs = exclude_from(cache_path, EXCLUDED_DIRS + GITKEEP_FILES) - FileUtils.rm_r(root_dirs.collect{|f| File.join(cache_path, f)}) + FileUtils.rm_r(root_dirs.collect { |f| File.join(cache_path, f) }) rescue Errno::ENOENT end @@ -80,7 +80,7 @@ module ActiveSupport def write_entry(key, entry, options) return false if options[:unless_exist] && File.exist?(key) ensure_cache_path(File.dirname(key)) - File.atomic_write(key, cache_path) {|f| Marshal.dump(entry, f)} + File.atomic_write(key, cache_path) { |f| Marshal.dump(entry, f) } true end diff --git a/activesupport/lib/active_support/cache/mem_cache_store.rb b/activesupport/lib/active_support/cache/mem_cache_store.rb index e51c6b2f10..cfd5e39bc4 100644 --- a/activesupport/lib/active_support/cache/mem_cache_store.rb +++ b/activesupport/lib/active_support/cache/mem_cache_store.rb @@ -85,7 +85,7 @@ module ActiveSupport @data = addresses.first else mem_cache_options = options.dup - UNIVERSAL_OPTIONS.each{|name| mem_cache_options.delete(name)} + UNIVERSAL_OPTIONS.each { |name| mem_cache_options.delete(name) } @data = self.class.build_mem_cache(*(addresses + [mem_cache_options])) end end @@ -96,7 +96,7 @@ module ActiveSupport options = names.extract_options! options = merged_options(options) - keys_to_names = Hash[names.map{|name| [normalize_key(name, options), name]}] + keys_to_names = Hash[names.map { |name| [normalize_key(name, options), name] }] raw_values = @data.get_multi(keys_to_names.keys, raw: true) values = {} raw_values.each do |key, value| @@ -176,7 +176,7 @@ module ActiveSupport def normalize_key(key, options) key = super.dup key = key.force_encoding(Encoding::ASCII_8BIT) - key = key.gsub(ESCAPE_KEY_CHARS){ |match| "%#{match.getbyte(0).to_s(16).upcase}" } + key = key.gsub(ESCAPE_KEY_CHARS) { |match| "%#{match.getbyte(0).to_s(16).upcase}" } key = "#{key[0, 213]}:md5:#{Digest::MD5.hexdigest(key)}" if key.size > 250 key end diff --git a/activesupport/lib/active_support/cache/memory_store.rb b/activesupport/lib/active_support/cache/memory_store.rb index d7dc574f5b..dbe55d7ce1 100644 --- a/activesupport/lib/active_support/cache/memory_store.rb +++ b/activesupport/lib/active_support/cache/memory_store.rb @@ -40,7 +40,7 @@ module ActiveSupport def cleanup(options = nil) options = merged_options(options) instrument(:cleanup, size: @data.size) do - keys = synchronize{ @data.keys } + keys = synchronize { @data.keys } keys.each do |key| entry = @data[key] delete_entry(key, options) if entry && entry.expired? @@ -57,7 +57,7 @@ module ActiveSupport start_time = Time.now cleanup instrument(:prune, target_size, from: @cache_size) do - keys = synchronize{ @key_access.keys.sort{|a,b| @key_access[a].to_f <=> @key_access[b].to_f} } + keys = synchronize { @key_access.keys.sort { |a,b| @key_access[a].to_f <=> @key_access[b].to_f } } keys.each do |key| delete_entry(key, options) return if @cache_size <= target_size || (max_time && Time.now - start_time > max_time) diff --git a/activesupport/lib/active_support/cache/strategy/local_cache.rb b/activesupport/lib/active_support/cache/strategy/local_cache.rb index 8ed8ab36ab..fbc28fedb1 100644 --- a/activesupport/lib/active_support/cache/strategy/local_cache.rb +++ b/activesupport/lib/active_support/cache/strategy/local_cache.rb @@ -92,14 +92,14 @@ module ActiveSupport def increment(name, amount = 1, options = nil) # :nodoc: return super unless local_cache - value = bypass_local_cache{super} + value = bypass_local_cache { super } write_cache_value(name, value, options) value end def decrement(name, amount = 1, options = nil) # :nodoc: return super unless local_cache - value = bypass_local_cache{super} + value = bypass_local_cache { super } write_cache_value(name, value, options) value end |