cachetastic 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. data/doc/classes/ActiveRecord/Base.html +188 -0
  2. data/doc/classes/CGI/Session/CachetasticStore.html +124 -0
  3. data/doc/classes/Cachetastic/Adapters/Base.html +331 -0
  4. data/doc/classes/Cachetastic/Adapters/Drb.html +332 -0
  5. data/doc/classes/Cachetastic/Adapters/File.html +248 -0
  6. data/doc/classes/Cachetastic/Adapters/FileBase.html +309 -0
  7. data/doc/classes/Cachetastic/Adapters/HtmlFile.html +224 -0
  8. data/doc/classes/Cachetastic/Adapters/LocalMemory.html +346 -0
  9. data/doc/classes/Cachetastic/Adapters/Memcache.html +498 -0
  10. data/doc/classes/Cachetastic/Cacheable.html +264 -0
  11. data/doc/classes/Cachetastic/Cacheable/ClassAndInstanceMethods.html +287 -0
  12. data/doc/classes/Cachetastic/Cacheable/ClassOnlyMethods.html +200 -0
  13. data/doc/classes/Cachetastic/Caches/Base.html +672 -0
  14. data/doc/classes/Cachetastic/Caches/Base/RegisteredCaches.html +179 -0
  15. data/doc/classes/Cachetastic/Caches/MackSessionCache.html +119 -0
  16. data/doc/classes/Cachetastic/Caches/PageCache.html +121 -0
  17. data/doc/classes/Cachetastic/Caches/RailsSessionCache.html +154 -0
  18. data/doc/classes/Cachetastic/Connection.html +212 -0
  19. data/doc/classes/Cachetastic/Errors/UnsupportedAdapter.html +146 -0
  20. data/doc/classes/Cachetastic/Logger.html +189 -0
  21. data/doc/classes/Object.html +152 -0
  22. data/doc/created.rid +1 -0
  23. data/doc/files/README.html +207 -0
  24. data/doc/files/lib/adapters/cachetastic_adapters_base_rb.html +139 -0
  25. data/doc/files/lib/adapters/cachetastic_adapters_drb_rb.html +115 -0
  26. data/doc/files/lib/adapters/cachetastic_adapters_file_base_rb.html +109 -0
  27. data/doc/files/lib/adapters/cachetastic_adapters_file_rb.html +121 -0
  28. data/doc/files/lib/adapters/cachetastic_adapters_html_file_rb.html +137 -0
  29. data/doc/files/lib/adapters/cachetastic_adapters_local_memory_rb.html +109 -0
  30. data/doc/files/lib/adapters/cachetastic_adapters_memcache_rb.html +127 -0
  31. data/doc/files/lib/adapters/cachetastic_adapters_store_object_rb.html +101 -0
  32. data/doc/files/lib/caches/cachetastic_caches_base_rb.html +108 -0
  33. data/doc/files/lib/caches/cachetastic_caches_mack_session_cache_rb.html +107 -0
  34. data/doc/files/lib/caches/cachetastic_caches_page_cache_rb.html +109 -0
  35. data/doc/files/lib/caches/cachetastic_caches_rails_session_cache_rb.html +107 -0
  36. data/doc/files/lib/cachetastic_cacheable_rb.html +101 -0
  37. data/doc/files/lib/cachetastic_connection_rb.html +107 -0
  38. data/doc/files/lib/cachetastic_logger_rb.html +107 -0
  39. data/doc/files/lib/cachetastic_rb.html +222 -0
  40. data/doc/files/lib/errors/cachetastic_errors_unsupported_adapter_rb.html +101 -0
  41. data/doc/files/lib/rails_extensions/cachetastic_active_record_base_rb.html +101 -0
  42. data/doc/files/lib/rails_extensions/cgi_session_cachetastic_store_rb.html +109 -0
  43. data/doc/files/lib/ruby_extensions/object_rb.html +101 -0
  44. data/doc/fr_class_index.html +47 -0
  45. data/doc/fr_file_index.html +47 -0
  46. data/doc/fr_method_index.html +100 -0
  47. data/doc/index.html +24 -0
  48. data/doc/rdoc-style.css +208 -0
  49. data/lib/cachetastic.rb +21 -23
  50. data/lib/cachetastic_cacheable.rb +202 -0
  51. data/lib/rails_extensions/cachetastic_active_record_base.rb +12 -39
  52. data/lib/ruby_extensions/object.rb +8 -0
  53. data/test/active_record_test.rb +8 -8
  54. data/test/cacheable_test.rb +72 -0
  55. metadata +52 -2
  56. data/lib/helpers/cachetastic_helpers_active_record.rb +0 -46
@@ -0,0 +1,152 @@
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: Object</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">Object</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/ruby_extensions/object_rb.html">
59
+ lib/ruby_extensions/object.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
+ <a href="Object.html">
69
+ Object
70
+ </a>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+ </div>
75
+ <!-- banner header -->
76
+
77
+ <div id="bodyContent">
78
+
79
+
80
+
81
+ <div id="contextContent">
82
+
83
+
84
+
85
+ </div>
86
+
87
+ <div id="method-list">
88
+ <h3 class="section-bar">Methods</h3>
89
+
90
+ <div class="name-list">
91
+ <a href="#M000001">cachetastic_key</a>&nbsp;&nbsp;
92
+ </div>
93
+ </div>
94
+
95
+ </div>
96
+
97
+
98
+ <!-- if includes -->
99
+
100
+ <div id="section">
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+ <!-- if method_list -->
110
+ <div id="methods">
111
+ <h3 class="section-bar">Public Instance methods</h3>
112
+
113
+ <div id="method-M000001" class="method-detail">
114
+ <a name="M000001"></a>
115
+
116
+ <div class="method-heading">
117
+ <a href="#M000001" class="method-signature">
118
+ <span class="method-name">cachetastic_key</span><span class="method-args">()</span>
119
+ </a>
120
+ </div>
121
+
122
+ <div class="method-description">
123
+ <p>
124
+ Override this method in your object if you use the <a
125
+ href="Cachetastic/Cacheable.html">Cachetastic::Cacheable</a> module.
126
+ </p>
127
+ <p><a class="source-toggle" href="#"
128
+ onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
129
+ <div class="method-source-code" id="M000001-source">
130
+ <pre>
131
+ <span class="ruby-comment cmt"># File lib/ruby_extensions/object.rb, line 4</span>
132
+ 4: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cachetastic_key</span>
133
+ 5: <span class="ruby-identifier">raise</span> <span class="ruby-constant">NoMethodError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'cachetastic_key'</span>)
134
+ 6: <span class="ruby-keyword kw">end</span>
135
+ </pre>
136
+ </div>
137
+ </div>
138
+ </div>
139
+
140
+
141
+ </div>
142
+
143
+
144
+ </div>
145
+
146
+
147
+ <div id="validator-badges">
148
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
149
+ </div>
150
+
151
+ </body>
152
+ </html>
data/doc/created.rid ADDED
@@ -0,0 +1 @@
1
+ Tue, 03 Jun 2008 17:30:28 -0400
@@ -0,0 +1,207 @@
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>Tue Jun 03 13:14:49 -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
+ <h1>Configuration:</h1>
73
+ <pre>
74
+ cachetastic_default_options:
75
+ # this will dump into the log, configuration info for each cache, as well as the .inspect
76
+ # for each object returned from the cache
77
+ debug: true # true | false (default: false)
78
+ # this is the type of file store to be used for this cache.
79
+ # more adapters can be developed and plugged in as desired
80
+ adapter: local_memory # local_memory | memcache | file | drb | html_file (default: local_memory)
81
+ # this will marshall objects into and out of the store.
82
+ marshall_method: none # none | yaml | ruby (default: none)
83
+ # this sets how long objects will live in the cache before they are auto expired.
84
+ default_expiry: &lt;%= 24.hours %&gt; # time in seconds (default: 24 hours)
85
+ # when setting objects into the cache the expiry_swing is +/- to the expiry time.
86
+ # example: if the expiry time is 1 hour, and the swing is 15 minutes,
87
+ # objects will go into the cache with an expiry time sometime between 45 mins and 75 mins.
88
+ expiry_swing: &lt;%= 15.minutes %&gt; # time in seconds (default: 0)
89
+ # these options get passed on directly to the store.
90
+ store_options: # listed below are options for memcache
91
+ c_threshold: 10_000
92
+ compression: true
93
+ debug: false
94
+ readonly: false
95
+ urlencode: false
96
+ store_options: # listed below are the options for file
97
+ dir: /cachetastic/caches/ # absolute path to the directory where caches should be stored.
98
+ store_options: # listed below are the options for drb
99
+ host: &quot;druby://127.0.0.1:61676&quot;
100
+ # configure logging for this cache:
101
+ logging:
102
+ # n number of logs can be configured for a cache
103
+ # their names can be anything you want, it's doesn't matter
104
+ logger_1:
105
+ # this sets the type of log you want to write to.
106
+ # right now the only two options are file and console
107
+ type: file # console | file (default: none)
108
+ # if the type is file, you need to configure where the log file is to be written.
109
+ file: log/memcached.log # relative | absolute path to log file
110
+ # this sets the level of logging for this cache
111
+ level: info # debug | info | warn | error | fatal (default: info)
112
+ logger_2:
113
+ # this sets the type of log you want to write to.
114
+ # right now the only two options are file and console
115
+ type: console # console | file (default: none)
116
+ # this sets the level of logging for this cache
117
+ level: error # debug | info | warn | error | fatal (default: info)
118
+ # set the servers to be used for memcache
119
+ servers:
120
+ - 127.0.0.1:11211 # ip:port used for memcache
121
+ </pre>
122
+ <p>
123
+ # example of how to override options for page cacheing:
124
+ </p>
125
+ <pre>
126
+ cachetastic_caches_page_cache_options:
127
+ default_expiry: &lt;%= 1.hour %&gt;
128
+ expiry_swing: &lt;%= 15.minutes %&gt;
129
+ </pre>
130
+ <p>
131
+ # example of how to override options for rails session cacheing:
132
+ </p>
133
+ <pre>
134
+ cachetastic_caches_rails_session_cache_options:
135
+ default_expiry: &lt;%= 30.minutes %&gt;
136
+ </pre>
137
+ <h1>Cachetastic::Drb::Server</h1>
138
+ <p>
139
+ If you want to use Drb and the <a
140
+ href="../classes/Cachetastic/Adapters/Drb.html">Cachetastic::Adapters::Drb</a>
141
+ adapter, you&#8216;ll have to use the Cachetastic::Drb::Server that comes
142
+ with Cachetastic. Using this server is simple. It gets installed as a
143
+ binary when you install the Cachetastic gem.
144
+ </p>
145
+ <pre>
146
+ $ cachetastic_drb_server # that will start the drb server on the host 127.0.0.1 on the port 61676
147
+ </pre>
148
+ <p>
149
+ The server takes to command line parameters: -h &lt;host&gt; -p
150
+ &lt;port&gt; -v &lt;verbose&gt; -rv &lt;really verbose&gt;
151
+ </p>
152
+ <h1>Examples:</h1>
153
+ <pre>
154
+ class MyAwesomeCache &lt; Cachetastic::Caches::Base
155
+ end
156
+
157
+ MyAwesomeCache.set(1, [1,2,3])
158
+ MyAwesomeCache.get(1) # =&gt; [1,2,3]
159
+
160
+ class MyAwesomeCache &lt; Cachetastic::Caches::Base
161
+ class &lt;&lt; self
162
+ def get(key, x, y)
163
+ super(key) do
164
+ n = x + y
165
+ set(key, n)
166
+ n
167
+ end
168
+ end
169
+ end
170
+ end
171
+
172
+ MyAwesomeCache.get(1, 2, 4) # =&gt; 8
173
+ MyAwesomeCache.get(1, 4, 4) # =&gt; 8
174
+ </pre>
175
+
176
+ </div>
177
+
178
+
179
+ </div>
180
+
181
+
182
+ </div>
183
+
184
+
185
+ <!-- if includes -->
186
+
187
+ <div id="section">
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+ <!-- if method_list -->
197
+
198
+
199
+ </div>
200
+
201
+
202
+ <div id="validator-badges">
203
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
204
+ </div>
205
+
206
+ </body>
207
+ </html>
@@ -0,0 +1,139 @@
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: cachetastic_adapters_base.rb</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>cachetastic_adapters_base.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/adapters/cachetastic_adapters_base.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Tue Jun 03 13:14:49 -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
+ <p>
73
+ This class is the interface used to develop adapters for stores. Stores are
74
+ where the data is actually held. These could be local memory, memcached, a
75
+ database, the file system, etc&#8230; If you implement this API, then you
76
+ should be able to plug in different stores for your caches without having
77
+ to change any of your code.
78
+ </p>
79
+ <h3>Methods that need to be implemented:</h3>
80
+ <ul>
81
+ <li>setup - used to setup the implementation of the adapter.
82
+
83
+ </li>
84
+ <li>set(key, object, expiry) - sets an object into the store using the given
85
+ key and the expiry time.
86
+
87
+ </li>
88
+ <li>get(key) - returns an object from the store for a given key.
89
+
90
+ </li>
91
+ <li>delete(key, delay) - deletes an object from the store for a given key. If
92
+ the store supports it, a delay can be used.
93
+
94
+ </li>
95
+ <li>expire_all - expires all objects in the store for a given cache.
96
+
97
+ </li>
98
+ <li>stats - returns statistics for the store.
99
+
100
+ </li>
101
+ <li>valid? - used to test whether or not the store is still valid. If this
102
+ returns false a new instance of the adapter is created by <a
103
+ href="../../../classes/Cachetastic/Connection.html">Cachetastic::Connection</a>
104
+
105
+ </li>
106
+ </ul>
107
+
108
+ </div>
109
+
110
+
111
+ </div>
112
+
113
+
114
+ </div>
115
+
116
+
117
+ <!-- if includes -->
118
+
119
+ <div id="section">
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+ <!-- if method_list -->
129
+
130
+
131
+ </div>
132
+
133
+
134
+ <div id="validator-badges">
135
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
136
+ </div>
137
+
138
+ </body>
139
+ </html>