Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
d2149256
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d2149256
编写于
7月 26, 2010
作者:
N
Neeraj Singh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
making comments meaningful by correcting, adding and pruning
上级
c77adb40
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
14 deletion
+13
-14
activesupport/lib/active_support/cache/mem_cache_store.rb
activesupport/lib/active_support/cache/mem_cache_store.rb
+3
-4
activesupport/lib/active_support/cache/memory_store.rb
activesupport/lib/active_support/cache/memory_store.rb
+5
-5
activesupport/lib/active_support/cache/strategy/local_cache.rb
...esupport/lib/active_support/cache/strategy/local_cache.rb
+5
-5
未找到文件。
activesupport/lib/active_support/cache/mem_cache_store.rb
浏览文件 @
d2149256
...
...
@@ -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
key
s from the cache using a single call to the
# Reads multiple
value
s 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
...
...
activesupport/lib/active_support/cache/memory_store.rb
浏览文件 @
d2149256
...
...
@@ -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
.
# Return
s true if the cache is currently being pruned
.
def
pruning?
@pruning
end
...
...
activesupport/lib/active_support/cache/strategy/local_cache.rb
浏览文件 @
d2149256
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录