Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
88c3fd1e
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,发现更多精彩内容 >>
提交
88c3fd1e
编写于
1月 03, 2014
作者:
G
Guillermo Iguaran
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #13583 from arthurnn/mem_cache_store_fix
mem_cache_store requires dalli, so only accept dalli/client
上级
05a81c5f
e7f56a7f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
12 addition
and
10 deletion
+12
-10
activesupport/CHANGELOG.md
activesupport/CHANGELOG.md
+4
-0
activesupport/lib/active_support/cache/mem_cache_store.rb
activesupport/lib/active_support/cache/mem_cache_store.rb
+4
-6
activesupport/test/caching_test.rb
activesupport/test/caching_test.rb
+4
-4
未找到文件。
activesupport/CHANGELOG.md
浏览文件 @
88c3fd1e
*
MemCacheStore should only accept a Dalli::Client, or create one.
*arthurnn*
*
Don't lazy load the
`tzinfo`
library as it causes problems on Windows.
Fixes #13553
...
...
activesupport/lib/active_support/cache/mem_cache_store.rb
浏览文件 @
88c3fd1e
...
...
@@ -41,17 +41,15 @@ def self.build_mem_cache(*addresses)
#
# If no addresses are specified, then MemCacheStore will connect to
# localhost port 11211 (the default memcached port).
#
# Instead of addresses one can pass in a MemCache-like object. For example:
#
# require 'memcached' # gem install memcached; uses C bindings to libmemcached
# ActiveSupport::Cache::MemCacheStore.new(Memcached::Rails.new("localhost:11211"))
def
initialize
(
*
addresses
)
addresses
=
addresses
.
flatten
options
=
addresses
.
extract_options!
super
(
options
)
if
addresses
.
first
.
respond_to?
(
:get
)
unless
[
String
,
Dalli
::
Client
,
NilClass
].
include?
(
addresses
.
first
.
class
)
raise
ArgumentError
,
"First argument must be an empty array, an array of hosts or a Dalli::Client instance."
end
if
addresses
.
first
.
is_a?
(
Dalli
::
Client
)
@data
=
addresses
.
first
else
mem_cache_options
=
options
.
dup
...
...
activesupport/test/caching_test.rb
浏览文件 @
88c3fd1e
...
...
@@ -110,12 +110,12 @@ def test_mem_cache_fragment_cache_store_with_given_mem_cache
assert_kind_of
(
ActiveSupport
::
Cache
::
MemCacheStore
,
store
)
end
def
test_mem_cache_fragment_cache_store_with_
given_mem_cache_like_objec
t
def
test_mem_cache_fragment_cache_store_with_
not_dalli_clien
t
Dalli
::
Client
.
expects
(
:new
).
never
memcache
=
Object
.
new
def
memcache
.
get
()
true
end
store
=
ActiveSupport
::
Cache
.
lookup_store
:mem_cache_store
,
memcache
assert_kind_of
(
ActiveSupport
::
Cache
::
MemCacheStore
,
store
)
assert_raises
(
ArgumentError
)
do
ActiveSupport
::
Cache
.
lookup_store
:mem_cache_store
,
memcache
end
end
def
test_mem_cache_fragment_cache_store_with_multiple_servers
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录