Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
5813aac6
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,发现更多精彩内容 >>
提交
5813aac6
编写于
2月 05, 2020
作者:
R
Ryuta Kamizono
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Simplify `lookup_store`
This fixes a regression #38532 caused by
f9633cd0
. Closes #38532.
上级
9184c121
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
7 addition
and
7 deletion
+7
-7
actionpack/lib/abstract_controller/caching.rb
actionpack/lib/abstract_controller/caching.rb
+1
-1
activesupport/lib/active_support/cache.rb
activesupport/lib/active_support/cache.rb
+3
-4
railties/lib/rails/application/bootstrap.rb
railties/lib/rails/application/bootstrap.rb
+1
-1
railties/test/application/middleware_test.rb
railties/test/application/middleware_test.rb
+2
-1
未找到文件。
actionpack/lib/abstract_controller/caching.rb
浏览文件 @
5813aac6
...
...
@@ -15,7 +15,7 @@ def cache_store
end
def
cache_store
=
(
store
)
config
.
cache_store
=
ActiveSupport
::
Cache
.
lookup_store
(
store
)
config
.
cache_store
=
ActiveSupport
::
Cache
.
lookup_store
(
*
store
)
end
private
...
...
activesupport/lib/active_support/cache.rb
浏览文件 @
5813aac6
...
...
@@ -52,12 +52,11 @@ class << self
#
# ActiveSupport::Cache.lookup_store(MyOwnCacheStore.new)
# # => returns MyOwnCacheStore.new
def
lookup_store
(
*
store_args
,
**
store_options
)
store
,
*
parameters
=
*
Array
.
wrap
(
store_args
).
flatten
def
lookup_store
(
store
=
nil
,
*
parameters
)
case
store
when
Symbol
retrieve_store_class
(
store
).
new
(
*
parameters
,
**
store_options
)
options
=
parameters
.
extract_options!
retrieve_store_class
(
store
).
new
(
*
parameters
,
**
options
)
when
nil
ActiveSupport
::
Cache
::
MemoryStore
.
new
else
...
...
railties/lib/rails/application/bootstrap.rb
浏览文件 @
5813aac6
...
...
@@ -56,7 +56,7 @@ module Bootstrap
# Initialize cache early in the stack so railties can make use of it.
initializer
:initialize_cache
,
group: :all
do
unless
Rails
.
cache
Rails
.
cache
=
ActiveSupport
::
Cache
.
lookup_store
(
config
.
cache_store
)
Rails
.
cache
=
ActiveSupport
::
Cache
.
lookup_store
(
*
config
.
cache_store
)
if
Rails
.
cache
.
respond_to?
(
:middleware
)
config
.
middleware
.
insert_before
(
::
Rack
::
Runtime
,
Rails
.
cache
.
middleware
)
...
...
railties/test/application/middleware_test.rb
浏览文件 @
5813aac6
...
...
@@ -238,9 +238,10 @@ def app
end
test
"Rails.cache does not respond to middleware"
do
add_to_config
"config.cache_store = :memory_store"
add_to_config
"config.cache_store = :memory_store
, { timeout: 10 }
"
boot!
assert_equal
"Rack::Runtime"
,
middleware
[
5
]
assert_instance_of
ActiveSupport
::
Cache
::
MemoryStore
,
Rails
.
cache
end
test
"Rails.cache does respond to middleware"
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录