Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document consistency [ci skip] #24587

Merged
merged 1 commit into from
Apr 18, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 19 additions & 19 deletions activesupport/lib/active_support/cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,20 +158,20 @@ class Store
attr_reader :silence, :options
alias :silence? :silence

# Create a new cache. The options will be passed to any write method calls
# Creates a new cache. The options will be passed to any write method calls
# except for <tt>:namespace</tt> which can be used to set the global
# namespace for the cache.
def initialize(options = nil)
@options = options ? options.dup : {}
end

# Silence the logger.
# Silences the logger.
def silence!
@silence = true
self
end

# Silence the logger within a block.
# Silences the logger within a block.
def mute
previous_silence, @silence = defined?(@silence) && @silence, true
yield
Expand Down Expand Up @@ -323,7 +323,7 @@ def read(name, options = nil)
end
end

# Read multiple values at once from the cache. Options can be passed
# Reads multiple values at once from the cache. Options can be passed
# in the last argument.
#
# Some cache implementation may optimize this method.
Expand Down Expand Up @@ -413,7 +413,7 @@ def exist?(name, options = nil)
end
end

# Delete all entries with keys matching the pattern.
# Deletes all entries with keys matching the pattern.
#
# Options are passed to the underlying cache implementation.
#
Expand All @@ -422,7 +422,7 @@ def delete_matched(matcher, options = nil)
raise NotImplementedError.new("#{self.class.name} does not support delete_matched")
end

# Increment an integer value in the cache.
# Increments an integer value in the cache.
#
# Options are passed to the underlying cache implementation.
#
Expand All @@ -431,7 +431,7 @@ def increment(name, amount = 1, options = nil)
raise NotImplementedError.new("#{self.class.name} does not support increment")
end

# Decrement an integer value in the cache.
# Decrements an integer value in the cache.
#
# Options are passed to the underlying cache implementation.
#
Expand All @@ -440,7 +440,7 @@ def decrement(name, amount = 1, options = nil)
raise NotImplementedError.new("#{self.class.name} does not support decrement")
end

# Cleanup the cache by removing expired entries.
# Cleanups the cache by removing expired entries.
#
# Options are passed to the underlying cache implementation.
#
Expand All @@ -449,7 +449,7 @@ def cleanup(options = nil)
raise NotImplementedError.new("#{self.class.name} does not support cleanup")
end

# Clear the entire cache. Be careful with this method since it could
# Clears the entire cache. Be careful with this method since it could
# affect other processes if shared cache is being used.
#
# The options hash is passed to the underlying cache implementation.
Expand All @@ -460,7 +460,7 @@ def clear(options = nil)
end

protected
# Add the namespace defined in the options to a pattern designed to
# Adds the namespace defined in the options to a pattern designed to
# match keys. Implementations that support delete_matched should call
# this method to translate a pattern that matches names into one that
# matches namespaced keys.
Expand All @@ -479,26 +479,26 @@ def key_matcher(pattern, options)
end
end

# Read an entry from the cache implementation. Subclasses must implement
# Reads an entry from the cache implementation. Subclasses must implement
# this method.
def read_entry(key, options) # :nodoc:
raise NotImplementedError.new
end

# Write an entry to the cache implementation. Subclasses must implement
# Writes an entry to the cache implementation. Subclasses must implement
# this method.
def write_entry(key, entry, options) # :nodoc:
raise NotImplementedError.new
end

# Delete an entry from the cache implementation. Subclasses must
# Deletes an entry from the cache implementation. Subclasses must
# implement this method.
def delete_entry(key, options) # :nodoc:
raise NotImplementedError.new
end

private
# Merge the default options with ones specific to a method call.
# Merges the default options with ones specific to a method call.
def merged_options(call_options) # :nodoc:
if call_options
options.merge(call_options)
Expand All @@ -507,7 +507,7 @@ def merged_options(call_options) # :nodoc:
end
end

# Expand key to be a consistent string value. Invoke +cache_key+ if
# Expands key to be a consistent string value. Invokes +cache_key+ if
# object responds to +cache_key+. Otherwise, +to_param+ method will be
# called. If the key is a Hash, then keys will be sorted alphabetically.
def expanded_key(key) # :nodoc:
Expand All @@ -527,7 +527,7 @@ def expanded_key(key) # :nodoc:
key.to_param
end

# Prefix a key with the namespace. Namespace and key will be delimited
# Prefixes a key with the namespace. Namespace and key will be delimited
# with a colon.
def normalize_key(key, options)
key = expanded_key(key)
Expand Down Expand Up @@ -598,7 +598,7 @@ def save_block_result_to_cache(name, options)
class Entry # :nodoc:
DEFAULT_COMPRESS_LIMIT = 16.kilobytes

# Create a new cache entry for the specified value. Options supported are
# Creates a new cache entry for the specified value. Options supported are
# +:compress+, +:compress_threshold+, and +:expires_in+.
def initialize(value, options = {})
if should_compress?(value, options)
Expand All @@ -617,7 +617,7 @@ def value
compressed? ? uncompress(@value) : @value
end

# Check if the entry is expired. The +expires_in+ parameter can override
# Checks if the entry is expired. The +expires_in+ parameter can override
# the value set when the entry was created.
def expired?
@expires_in && @created_at + @expires_in <= Time.now.to_f
Expand Down Expand Up @@ -652,7 +652,7 @@ def size
end
end

# Duplicate the value in a class. This is used by cache implementations that don't natively
# Duplicates the value in a class. This is used by cache implementations that don't natively
# serialize entries to protect against accidental cache modifications.
def dup_value!
if @value && !compressed? && !(@value.is_a?(Numeric) || @value == true || @value == false)
Expand Down