mack-caching 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +37 -0
- data/doc/classes/Mack/Controller/ClassMethods.html +151 -0
- data/doc/classes/Mack/Errors/UncacheableError.html +117 -0
- data/doc/created.rid +1 -0
- data/doc/files/README.html +151 -0
- data/doc/files/lib/mack-caching/errors_rb.html +101 -0
- data/doc/files/lib/mack-caching/page_caching/controller_extensions_rb.html +101 -0
- data/doc/files/lib/mack-caching/page_caching/page_caching_rb.html +101 -0
- data/doc/files/lib/mack-caching_rb.html +101 -0
- data/doc/fr_class_index.html +28 -0
- data/doc/fr_file_index.html +31 -0
- data/doc/fr_method_index.html +27 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/mack-caching/errors.rb +12 -0
- data/lib/mack-caching/page_caching/controller_extensions.rb +26 -0
- data/lib/mack-caching/page_caching/page_caching.rb +59 -0
- data/lib/mack-caching/tasks/cachetastic.rake +14 -0
- data/lib/mack-caching.rb +4 -0
- metadata +72 -0
data/README
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
== Page Caching
|
2
|
+
|
3
|
+
Using page caching with Mack, is incredibly easy. The first thing you
|
4
|
+
need to do is turn it on. In the app_config/*.yml file of your chosing
|
5
|
+
place the following configuration setting:
|
6
|
+
|
7
|
+
use_page_caching: true
|
8
|
+
|
9
|
+
That will now enable your application to use the page caching system.
|
10
|
+
A restart of your application is required for this to take effect.
|
11
|
+
|
12
|
+
Now that your application is using page caching, provided by the
|
13
|
+
Cachetastic gem, you need to tell it which controllers/actions you want
|
14
|
+
to cache.
|
15
|
+
|
16
|
+
To cache all the actions in your controller you would do something like
|
17
|
+
the following:
|
18
|
+
|
19
|
+
class UsersController
|
20
|
+
include Mack::Controller
|
21
|
+
|
22
|
+
cache_pages
|
23
|
+
|
24
|
+
# ...
|
25
|
+
# actions omitted
|
26
|
+
# ...
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
The cache_pages method takes similar inputs to before/after filters. If
|
31
|
+
you want to be more specific you can use either the :only or :except flags.
|
32
|
+
|
33
|
+
cache_pages :only => [:index, :show]
|
34
|
+
|
35
|
+
or
|
36
|
+
|
37
|
+
cache_pages :except => [:delete, :edit, :update]
|
@@ -0,0 +1,151 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: Mack::Controller::ClassMethods</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">Mack::Controller::ClassMethods</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/mack-caching/page_caching/controller_extensions_rb.html">
|
59
|
+
lib/mack-caching/page_caching/controller_extensions.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="method-list">
|
80
|
+
<h3 class="section-bar">Methods</h3>
|
81
|
+
|
82
|
+
<div class="name-list">
|
83
|
+
<a href="#M000001">cache_pages</a>
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
|
90
|
+
<!-- if includes -->
|
91
|
+
|
92
|
+
<div id="section">
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
<!-- if method_list -->
|
102
|
+
<div id="methods">
|
103
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
104
|
+
|
105
|
+
<div id="method-M000001" class="method-detail">
|
106
|
+
<a name="M000001"></a>
|
107
|
+
|
108
|
+
<div class="method-heading">
|
109
|
+
<a href="#M000001" class="method-signature">
|
110
|
+
<span class="method-name">cache_pages</span><span class="method-args">(options = {})</span>
|
111
|
+
</a>
|
112
|
+
</div>
|
113
|
+
|
114
|
+
<div class="method-description">
|
115
|
+
<p>
|
116
|
+
Used to define which pages you would or would not like cached.
|
117
|
+
</p>
|
118
|
+
<p>
|
119
|
+
Examples:
|
120
|
+
</p>
|
121
|
+
<pre>
|
122
|
+
cache_pages # => will cache all pages for a controller
|
123
|
+
cache_pages :only => [:index, :show] # => will only cache the index and show pages for a controller
|
124
|
+
cache_pages :except => [:delete] # => will cache all pages except for the delete page for a controller
|
125
|
+
</pre>
|
126
|
+
<p><a class="source-toggle" href="#"
|
127
|
+
onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
|
128
|
+
<div class="method-source-code" id="M000001-source">
|
129
|
+
<pre>
|
130
|
+
<span class="ruby-comment cmt"># File lib/mack-caching/page_caching/controller_extensions.rb, line 13</span>
|
131
|
+
13: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cache_pages</span>(<span class="ruby-identifier">options</span> = {})
|
132
|
+
14: <span class="ruby-identifier">before_filter</span> <span class="ruby-identifier">:set_page_cache_header</span>, <span class="ruby-identifier">options</span>
|
133
|
+
15: <span class="ruby-keyword kw">end</span>
|
134
|
+
</pre>
|
135
|
+
</div>
|
136
|
+
</div>
|
137
|
+
</div>
|
138
|
+
|
139
|
+
|
140
|
+
</div>
|
141
|
+
|
142
|
+
|
143
|
+
</div>
|
144
|
+
|
145
|
+
|
146
|
+
<div id="validator-badges">
|
147
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
148
|
+
</div>
|
149
|
+
|
150
|
+
</body>
|
151
|
+
</html>
|
@@ -0,0 +1,117 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Mack::Errors::UncacheableError</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Mack::Errors::UncacheableError</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/mack-caching/errors_rb.html">
|
59
|
+
lib/mack-caching/errors.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
StandardError
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
Thrown when a page is uncacheable
|
84
|
+
</p>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
|
92
|
+
</div>
|
93
|
+
|
94
|
+
|
95
|
+
<!-- if includes -->
|
96
|
+
|
97
|
+
<div id="section">
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
<!-- if method_list -->
|
107
|
+
|
108
|
+
|
109
|
+
</div>
|
110
|
+
|
111
|
+
|
112
|
+
<div id="validator-badges">
|
113
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
114
|
+
</div>
|
115
|
+
|
116
|
+
</body>
|
117
|
+
</html>
|
data/doc/created.rid
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Fri, 01 Aug 2008 14:36:08 -0400
|
@@ -0,0 +1,151 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>File: README</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="fileHeader">
|
50
|
+
<h1>README</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>README
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Fri Aug 01 13:13:43 -0400 2008</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
<div id="description">
|
72
|
+
<h2>Page Caching</h2>
|
73
|
+
<p>
|
74
|
+
Using page caching with Mack, is incredibly easy. The first thing you need
|
75
|
+
to do is turn it on. In the app_config/*.yml file of your chosing place the
|
76
|
+
following configuration setting:
|
77
|
+
</p>
|
78
|
+
<pre>
|
79
|
+
use_page_caching: true
|
80
|
+
</pre>
|
81
|
+
<p>
|
82
|
+
That will now enable your application to use the page caching system. A
|
83
|
+
restart of your application is required for this to take effect.
|
84
|
+
</p>
|
85
|
+
<p>
|
86
|
+
Now that your application is using page caching, provided by the
|
87
|
+
Cachetastic gem, you need to tell it which controllers/actions you want to
|
88
|
+
cache.
|
89
|
+
</p>
|
90
|
+
<p>
|
91
|
+
To cache all the actions in your controller you would do something like the
|
92
|
+
following:
|
93
|
+
</p>
|
94
|
+
<pre>
|
95
|
+
class UsersController
|
96
|
+
include Mack::Controller
|
97
|
+
|
98
|
+
cache_pages
|
99
|
+
|
100
|
+
# ...
|
101
|
+
# actions omitted
|
102
|
+
# ...
|
103
|
+
|
104
|
+
end
|
105
|
+
</pre>
|
106
|
+
<p>
|
107
|
+
The cache_pages method takes similar inputs to before/after filters. If you
|
108
|
+
want to be more specific you can use either the :only or :except flags.
|
109
|
+
</p>
|
110
|
+
<pre>
|
111
|
+
cache_pages :only => [:index, :show]
|
112
|
+
</pre>
|
113
|
+
<p>
|
114
|
+
or
|
115
|
+
</p>
|
116
|
+
<pre>
|
117
|
+
cache_pages :except => [:delete, :edit, :update]
|
118
|
+
</pre>
|
119
|
+
|
120
|
+
</div>
|
121
|
+
|
122
|
+
|
123
|
+
</div>
|
124
|
+
|
125
|
+
|
126
|
+
</div>
|
127
|
+
|
128
|
+
|
129
|
+
<!-- if includes -->
|
130
|
+
|
131
|
+
<div id="section">
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
<!-- if method_list -->
|
141
|
+
|
142
|
+
|
143
|
+
</div>
|
144
|
+
|
145
|
+
|
146
|
+
<div id="validator-badges">
|
147
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
148
|
+
</div>
|
149
|
+
|
150
|
+
</body>
|
151
|
+
</html>
|