Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
068ab23a
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,发现更多精彩内容 >>
提交
068ab23a
编写于
6月 18, 2015
作者:
R
Robin Dupret
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tiny documentation fixes [ci skip]
上级
3f767aa9
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
12 addition
and
10 deletion
+12
-10
guides/source/caching_with_rails.md
guides/source/caching_with_rails.md
+9
-7
guides/source/development_dependencies_install.md
guides/source/development_dependencies_install.md
+3
-3
未找到文件。
guides/source/caching_with_rails.md
浏览文件 @
068ab23a
...
@@ -70,13 +70,13 @@ code:
...
@@ -70,13 +70,13 @@ code:
When your application receives its first request to this page, Rails will write
When your application receives its first request to this page, Rails will write
a new cache entry with a unique key. A key looks something like this:
a new cache entry with a unique key. A key looks something like this:
```
html
```
views/products/1-201505056193031061005000/bea67108094918eeba42cd4a6e786901
views/products/1-201505056193031061005000/bea67108094918eeba42cd4a6e786901
```
```
The number in the middle is the
`product_id`
followed by the timestamp value in
The number in the middle is the
`product_id`
followed by the timestamp value in
the
`updated_at`
value of the product record. Rails uses the timestamp value to
the
`updated_at`
attribute of the product record. Rails uses the timestamp value
make sure it is not serving stale data. If the value of
`updated_at`
has
to
make sure it is not serving stale data. If the value of
`updated_at`
has
changed, a new key will be generated. Then Rails will write a new cache to that
changed, a new key will be generated. Then Rails will write a new cache to that
key, and the old cache written to the old key will never be used again. This is
key, and the old cache written to the old key will never be used again. This is
called key-based expiration.
called key-based expiration.
...
@@ -90,7 +90,7 @@ will change, expiring the existing file.
...
@@ -90,7 +90,7 @@ will change, expiring the existing file.
TIP: Cache stores like Memcached will automatically delete old cache files.
TIP: Cache stores like Memcached will automatically delete old cache files.
If you want to cache a fragment under certain conditions, you can use
If you want to cache a fragment under certain conditions, you can use
`cache_if`
or
`cache_unless`
`cache_if`
or
`cache_unless`
:
```
erb
```
erb
<%
cache_if
admin?
,
product
do
%>
<%
cache_if
admin?
,
product
do
%>
...
@@ -144,8 +144,8 @@ end
...
@@ -144,8 +144,8 @@ end
```
```
With
`touch`
set to true, any action which changes
`updated_at`
for a game
With
`touch`
set to true, any action which changes
`updated_at`
for a game
column will also change it in the associated product column, thereby expiring
record will also change it for the associated product, thereby expiring the
the
cache.
cache.
### Low-Level Caching
### Low-Level Caching
...
@@ -410,6 +410,8 @@ class ProductsController < ApplicationController
...
@@ -410,6 +410,8 @@ class ProductsController < ApplicationController
end
end
```
```
### References
References
----------
*
[
DHH's article on key-based expiration
](
https://signalvnoise.com/posts/3113-how-key-based-cache-expiration-works
)
*
[
DHH's article on key-based expiration
](
https://signalvnoise.com/posts/3113-how-key-based-cache-expiration-works
)
*
[
Ryan Bates' Railscast on cache digests
](
http://railscasts.com/episodes/387-cache-digests
)
*
[
Ryan Bates' Railscast on cache digests
](
http://railscasts.com/episodes/387-cache-digests
)
guides/source/development_dependencies_install.md
浏览文件 @
068ab23a
...
@@ -9,7 +9,7 @@ After reading this guide, you will know:
...
@@ -9,7 +9,7 @@ After reading this guide, you will know:
*
How to set up your machine for Rails development
*
How to set up your machine for Rails development
*
How to run specific groups of unit tests from the Rails test suite
*
How to run specific groups of unit tests from the Rails test suite
*
How the ActiveRecord portion of the Rails test suite operates
*
How the Active
Record portion of the Rails test suite operates
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
...
@@ -60,7 +60,7 @@ In Ubuntu you're done with just:
...
@@ -60,7 +60,7 @@ In Ubuntu you're done with just:
$
sudo
apt-get
install
sqlite3 libsqlite3-dev
$
sudo
apt-get
install
sqlite3 libsqlite3-dev
```
```
And i
f you are on Fedora or CentOS, you're done with
I
f you are on Fedora or CentOS, you're done with
```
bash
```
bash
$
sudo
yum
install
sqlite3 sqlite3-devel
$
sudo
yum
install
sqlite3 sqlite3-devel
...
@@ -213,7 +213,7 @@ FreeBSD users will have to run the following:
...
@@ -213,7 +213,7 @@ FreeBSD users will have to run the following:
```
bash
```
bash
# pkg install mysql56-client mysql56-server
# pkg install mysql56-client mysql56-server
# pkg install postgresql9
3-client postgresql93
-server
# pkg install postgresql9
4-client postgresql94
-server
```
```
Or install them through ports (they are located under the
`databases`
folder).
Or install them through ports (they are located under the
`databases`
folder).
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录