提交 d2149256 编写于 作者: N Neeraj Singh

making comments meaningful by correcting, adding and pruning

上级 c77adb40
......@@ -16,8 +16,7 @@ module Cache
# Special features:
# - Clustering and load balancing. One can specify multiple memcached servers,
# and MemCacheStore will load balance between all available servers. If a
# server goes down, then MemCacheStore will ignore it until it goes back
# online.
# server goes down, then MemCacheStore will ignore it until it comes back up.
#
# MemCacheStore implements the Strategy::LocalCache strategy which implements
# an in memory cache inside of a block.
......@@ -69,7 +68,7 @@ def initialize(*addresses)
extend LocalCacheWithRaw
end
# Reads multiple keys from the cache using a single call to the
# Reads multiple values from the cache using a single call to the
# servers for all keys. Options can be passed in the last argument.
def read_multi(*names)
options = names.extract_options!
......@@ -113,7 +112,7 @@ def decrement(name, amount = 1, options = nil) # :nodoc:
end
# Clear the entire cache on all memcached servers. This method should
# be used with care when using a shared cache.
# be used with care when shared cache is being used.
def clear(options = nil)
@data.flush_all
end
......
......@@ -5,9 +5,9 @@ module Cache
# A cache store implementation which stores everything into memory in the
# same process. If you're running multiple Ruby on Rails server processes
# (which is the case if you're using mongrel_cluster or Phusion Passenger),
# then this means that your Rails server process instances won't be able
# then this means that Rails server process instances won't be able
# to share cache data with each other and this may not be the most
# appropriate cache for you.
# appropriate cache in that scenario.
#
# This cache has a bounded size specified by the :size options to the
# initializer (default is 32Mb). When the cache exceeds the allotted size,
......@@ -47,8 +47,8 @@ def cleanup(options = nil)
end
end
# Prune the cache down so the entries fit within the specified memory size by removing
# the least recently accessed entries.
# To ensure entries fit within the specified memory prune the cache by removing the least
# recently accessed entries.
def prune(target_size, max_time = nil)
return if pruning?
@pruning = true
......@@ -67,7 +67,7 @@ def prune(target_size, max_time = nil)
end
end
# Return true if the cache is currently be pruned to remove older entries.
# Returns true if the cache is currently being pruned.
def pruning?
@pruning
end
......
......@@ -8,7 +8,7 @@ module Strategy
# duration of a block. Repeated calls to the cache for the same key will hit the
# in memory cache for faster access.
module LocalCache
# Simple memory backed cache. This cache is not thread safe but is intended only
# Simple memory backed cache. This cache is not thread safe and is intended only
# for serving as a temporary memory cache for a single thread.
class LocalStore < Store
def initialize
......@@ -16,7 +16,7 @@ def initialize
@data = {}
end
# Since it isn't thread safe, don't allow synchronizing.
# Don't allow synchronizing since it isn't thread safe,
def synchronize # :nodoc:
yield
end
......@@ -39,7 +39,7 @@ def delete_entry(key, options)
end
end
# Use a local cache to front for the cache for the duration of a block.
# Use a local cache for the duration of block.
def with_local_cache
save_val = Thread.current[thread_local_key]
begin
......@@ -50,8 +50,8 @@ def with_local_cache
end
end
# Middleware class can be inserted as a Rack handler to use a local cache for the
# duration of a request.
# Middleware class can be inserted as a Rack handler to be local cache for the
# duration of request.
def middleware
@middleware ||= begin
klass = Class.new
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册