forked from railsdoc/railsdoc.github.io
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCaching.html
188 lines (93 loc) Β· 4.21 KB
/
Caching.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
---
title: AbstractController::Caching
layout: default
---
<div class="main">
<div class="banner">
<span>Ruby on Rails 5.2.8</span><br />
<div class="type">Module</div>
<h1>
AbstractController::Caching
</h1>
<ul class="files">
<li><a href="../../files/actionpack/lib/abstract_controller/caching_rb.html">actionpack/lib/abstract_controller/caching.rb</a></li>
<li><a href="../../files/actionpack/lib/abstract_controller/caching/fragments_rb.html">actionpack/lib/abstract_controller/caching/fragments.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<h2 id="namespace">Namespace</h2>
<h3 id="module">Module</h3>
<ul>
<li><a href="Caching/ClassMethods.html">AbstractController::Caching::ClassMethods</a></li>
<li><a href="Caching/ConfigMethods.html">AbstractController::Caching::ConfigMethods</a></li>
<li><a href="Caching/Fragments.html">AbstractController::Caching::Fragments</a></li>
</ul>
<h2 id="methods">Methods</h2>
<ul>
<li>
<a href="#method-i-cache">cache</a>
</li>
<li>
<a href="#method-i-view_cache_dependencies">view_cache_dependencies</a>
</li>
</ul>
<!-- Includes -->
<h2 id="included-modules">Included Modules</h2>
<ul>
<li>
<a href="Caching/ConfigMethods.html">
AbstractController::Caching::ConfigMethods
</a>
</li>
<li>
<a href="Caching/Fragments.html">
AbstractController::Caching::Fragments
</a>
</li>
</ul>
<!-- Methods -->
<h2 id="instance-public-methods">Instance Public methods</h2>
<div class="method">
<h3 id="method-i-view_cache_dependencies">
view_cache_dependencies()
</h3>
<div class="description">
</div>
<details class="method__source">
<summary>
<span class="label">π Source code</span>
</summary>
<pre><code class="ruby"># File actionpack/lib/abstract_controller/caching.rb, line 52
def view_cache_dependencies
self.class._view_cache_dependencies.map { |dep| instance_exec(&dep) }.compact
end</code></pre>
<a href="https://github.com/rails/rails/blob/26521331e5923a0c50fa50984d2f924e5f26c50b/actionpack/lib/abstract_controller/caching.rb#L52" target="_blank" class="github_url">π See on GitHub</a>
</details>
</div>
<h2 id="instance-private-methods">Instance Private methods</h2>
<div class="method">
<h3 id="method-i-cache">
cache(key, options = {}, &block)
</h3>
<div class="description">
<p>Convenience accessor.</p>
</div>
<details class="method__source">
<summary>
<span class="label">π Source code</span>
</summary>
<pre><code class="ruby"># File actionpack/lib/abstract_controller/caching.rb, line 58
def cache(key, options = {}, &block) # :doc:
if cache_configured?
cache_store.fetch(ActiveSupport::Cache.expand_cache_key(key, :controller), options, &block)
else
yield
end
end</code></pre>
<a href="https://github.com/rails/rails/blob/26521331e5923a0c50fa50984d2f924e5f26c50b/actionpack/lib/abstract_controller/caching.rb#L58" target="_blank" class="github_url">π See on GitHub</a>
</details>
</div>
</div>
</div>
</div>