cachetastic 2.1.1 → 2.1.2
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.
- data/doc/classes/Cachetastic/Adapters/Base.html +23 -25
- data/doc/created.rid +1 -1
- data/doc/files/lib/cachetastic/adapters/base_rb.html +1 -1
- data/doc/files/lib/cachetastic/ruby_extensions/kernel_rb.html +101 -0
- data/doc/files/lib/cachetastic_rb.html +1 -2
- data/doc/fr_file_index.html +1 -0
- data/lib/cachetastic/adapters/base.rb +1 -3
- data/lib/cachetastic/ruby_extensions/kernel.rb +25 -0
- data/lib/cachetastic.rb +3 -1
- metadata +5 -13
@@ -199,12 +199,12 @@ Examples:
|
|
199
199
|
onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
|
200
200
|
<div class="method-source-code" id="M000036-source">
|
201
201
|
<pre>
|
202
|
-
<span class="ruby-comment cmt"># File lib/cachetastic/adapters/base.rb, line
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
202
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/adapters/base.rb, line 69</span>
|
203
|
+
69: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">configuration</span>(<span class="ruby-identifier">name</span>)
|
204
|
+
70: <span class="ruby-identifier">name</span> = <span class="ruby-node">"#{name}_options"</span>
|
205
|
+
71: <span class="ruby-identifier">conf</span> = <span class="ruby-identifier">configatron</span>.<span class="ruby-identifier">retrieve</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">configatron</span>.<span class="ruby-identifier">cachetastic_default_options</span>)
|
206
|
+
72: <span class="ruby-identifier">conf</span>
|
207
|
+
73: <span class="ruby-keyword kw">end</span>
|
208
208
|
</pre>
|
209
209
|
</div>
|
210
210
|
</div>
|
@@ -254,10 +254,10 @@ Examples:
|
|
254
254
|
onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
|
255
255
|
<div class="method-source-code" id="M000035-source">
|
256
256
|
<pre>
|
257
|
-
<span class="ruby-comment cmt"># File lib/cachetastic/adapters/base.rb, line
|
258
|
-
|
259
|
-
|
260
|
-
|
257
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/adapters/base.rb, line 58</span>
|
258
|
+
58: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">configuration</span>
|
259
|
+
59: <span class="ruby-constant">Cachetastic</span><span class="ruby-operator">::</span><span class="ruby-constant">Adapters</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">configuration</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">name</span>)
|
260
|
+
60: <span class="ruby-keyword kw">end</span>
|
261
261
|
</pre>
|
262
262
|
</div>
|
263
263
|
</div>
|
@@ -284,10 +284,8 @@ config setting is set, then false is returned.
|
|
284
284
|
<pre>
|
285
285
|
<span class="ruby-comment cmt"># File lib/cachetastic/adapters/base.rb, line 43</span>
|
286
286
|
43: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">debug?</span>
|
287
|
-
44: <span class="ruby-identifier">
|
288
|
-
45:
|
289
|
-
46: <span class="ruby-keyword kw">end</span>
|
290
|
-
47: <span class="ruby-keyword kw">end</span>
|
287
|
+
44: <span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">retrieve</span>(<span class="ruby-identifier">:debug</span>, <span class="ruby-keyword kw">false</span>)
|
288
|
+
45: <span class="ruby-keyword kw">end</span>
|
291
289
|
</pre>
|
292
290
|
</div>
|
293
291
|
</div>
|
@@ -307,17 +305,17 @@ config setting is set, then false is returned.
|
|
307
305
|
onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
|
308
306
|
<div class="method-source-code" id="M000034-source">
|
309
307
|
<pre>
|
310
|
-
<span class="ruby-comment cmt"># File lib/cachetastic/adapters/base.rb, line
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
308
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/adapters/base.rb, line 47</span>
|
309
|
+
47: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stats</span>
|
310
|
+
48: <span class="ruby-identifier">cache_name</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">camelize</span>
|
311
|
+
49: <span class="ruby-identifier">adapter_type</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'Cachetastic::Adapters::'</span>, <span class="ruby-value str">''</span>)
|
312
|
+
50: <span class="ruby-identifier">s</span> = <span class="ruby-node">"Cache: #{cache_name}\nStore Type: #{adapter_type}\n"</span>
|
313
|
+
51: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">servers</span>
|
314
|
+
52: <span class="ruby-identifier">servers</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">servers</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">','</span>)
|
315
|
+
53: <span class="ruby-identifier">s</span> <span class="ruby-operator">+=</span> <span class="ruby-node">"Servers: #{servers}"</span>
|
316
|
+
54: <span class="ruby-keyword kw">end</span>
|
317
|
+
55: <span class="ruby-identifier">puts</span> <span class="ruby-identifier">s</span>
|
318
|
+
56: <span class="ruby-keyword kw">end</span>
|
321
319
|
</pre>
|
322
320
|
</div>
|
323
321
|
</div>
|
data/doc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Fri, 16 Jan 2009 18:05:14 -0500
|
@@ -0,0 +1,101 @@
|
|
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: kernel.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>kernel.rb</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>lib/cachetastic/ruby_extensions/kernel.rb
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Fri Jan 16 18:02:14 -0500 2009</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
</div>
|
74
|
+
|
75
|
+
|
76
|
+
</div>
|
77
|
+
|
78
|
+
|
79
|
+
<!-- if includes -->
|
80
|
+
|
81
|
+
<div id="section">
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
<!-- if method_list -->
|
91
|
+
|
92
|
+
|
93
|
+
</div>
|
94
|
+
|
95
|
+
|
96
|
+
<div id="validator-badges">
|
97
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
98
|
+
</div>
|
99
|
+
|
100
|
+
</body>
|
101
|
+
</html>
|
@@ -56,7 +56,7 @@
|
|
56
56
|
</tr>
|
57
57
|
<tr class="top-aligned-row">
|
58
58
|
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>
|
59
|
+
<td>Fri Jan 16 18:02:52 -0500 2009</td>
|
60
60
|
</tr>
|
61
61
|
</table>
|
62
62
|
</div>
|
@@ -168,7 +168,6 @@ The server takes to command line parameters: -h <host> -p
|
|
168
168
|
pp
|
169
169
|
drb
|
170
170
|
configatron
|
171
|
-
mack-facets
|
172
171
|
memcache
|
173
172
|
</div>
|
174
173
|
</div>
|
data/doc/fr_file_index.html
CHANGED
@@ -40,6 +40,7 @@
|
|
40
40
|
<a href="files/lib/cachetastic/logger_rb.html">lib/cachetastic/logger.rb</a><br />
|
41
41
|
<a href="files/lib/cachetastic/rails_extensions/active_record_base_rb.html">lib/cachetastic/rails_extensions/active_record_base.rb</a><br />
|
42
42
|
<a href="files/lib/cachetastic/rails_extensions/cgi_session_store_rb.html">lib/cachetastic/rails_extensions/cgi_session_store.rb</a><br />
|
43
|
+
<a href="files/lib/cachetastic/ruby_extensions/kernel_rb.html">lib/cachetastic/ruby_extensions/kernel.rb</a><br />
|
43
44
|
<a href="files/lib/cachetastic/ruby_extensions/object_rb.html">lib/cachetastic/ruby_extensions/object.rb</a><br />
|
44
45
|
</div>
|
45
46
|
</div>
|
@@ -41,9 +41,7 @@ class Cachetastic::Adapters::Base
|
|
41
41
|
# Returns true/or falsed based on whether or not the debug setting is set to true in the
|
42
42
|
# configuration file. If the config setting is set, then false is returned.
|
43
43
|
def debug?
|
44
|
-
|
45
|
-
configuration.retrieve(:debug, false)
|
46
|
-
end
|
44
|
+
configuration.retrieve(:debug, false)
|
47
45
|
end
|
48
46
|
|
49
47
|
def stats
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Kernel # :nodoc:
|
2
|
+
|
3
|
+
def retryable(options = {}, &block) # :nodoc:
|
4
|
+
opts = { :tries => 1, :on => Exception }.merge(options)
|
5
|
+
|
6
|
+
retries = opts[:tries]
|
7
|
+
retry_exceptions = [opts[:on]].flatten
|
8
|
+
|
9
|
+
x = %{
|
10
|
+
begin
|
11
|
+
return yield
|
12
|
+
rescue #{retry_exceptions.join(", ")} => e
|
13
|
+
retries -= 1
|
14
|
+
if retries > 0
|
15
|
+
retry
|
16
|
+
else
|
17
|
+
raise e
|
18
|
+
end
|
19
|
+
end
|
20
|
+
}
|
21
|
+
|
22
|
+
eval(x, &block)
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
data/lib/cachetastic.rb
CHANGED
@@ -7,7 +7,7 @@ require 'zlib'
|
|
7
7
|
require 'pp'
|
8
8
|
require 'drb'
|
9
9
|
require 'configatron'
|
10
|
-
require 'mack-facets'
|
10
|
+
# require 'mack-facets'
|
11
11
|
begin
|
12
12
|
require 'memcache'
|
13
13
|
rescue Exception => e
|
@@ -61,6 +61,8 @@ require File.join(home, 'adapters/drb')
|
|
61
61
|
require File.join(home, 'cacheable')
|
62
62
|
require File.join(home, 'rails_extensions/active_record_base')
|
63
63
|
require File.join(home, 'rails_extensions/cgi_session_store')
|
64
|
+
require File.join(home, 'ruby_extensions/object')
|
65
|
+
require File.join(home, 'ruby_extensions/kernel')
|
64
66
|
|
65
67
|
configatron.cachetastic_default_options.set_default(:debug, false)
|
66
68
|
configatron.cachetastic_default_options.set_default(:adapter, :local_memory)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cachetastic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- markbates
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-01-
|
12
|
+
date: 2009-01-16 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,17 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
24
|
-
version:
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: mack-facets
|
27
|
-
type: :runtime
|
28
|
-
version_requirement:
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: "0"
|
23
|
+
version: 2.2.2
|
34
24
|
version:
|
35
25
|
description: A very simple, yet very powerful caching framework for Ruby.
|
36
26
|
email: mark@mackframework.com
|
@@ -59,6 +49,7 @@ files:
|
|
59
49
|
- lib/cachetastic/logger.rb
|
60
50
|
- lib/cachetastic/rails_extensions/active_record_base.rb
|
61
51
|
- lib/cachetastic/rails_extensions/cgi_session_store.rb
|
52
|
+
- lib/cachetastic/ruby_extensions/kernel.rb
|
62
53
|
- lib/cachetastic/ruby_extensions/object.rb
|
63
54
|
- lib/cachetastic.rb
|
64
55
|
- README
|
@@ -102,6 +93,7 @@ files:
|
|
102
93
|
- doc/files/lib/cachetastic/logger_rb.html
|
103
94
|
- doc/files/lib/cachetastic/rails_extensions/active_record_base_rb.html
|
104
95
|
- doc/files/lib/cachetastic/rails_extensions/cgi_session_store_rb.html
|
96
|
+
- doc/files/lib/cachetastic/ruby_extensions/kernel_rb.html
|
105
97
|
- doc/files/lib/cachetastic/ruby_extensions/object_rb.html
|
106
98
|
- doc/files/lib/cachetastic_rb.html
|
107
99
|
- doc/files/README.html
|