cachetastic 1.7.4 → 2.0.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.
- data/README +31 -44
- data/bin/cachetastic_drb_server +115 -0
- data/doc/classes/ActiveRecord/Base.html +16 -16
- data/doc/classes/CGI/Session/CachetasticStore.html +2 -2
- data/doc/classes/Cachetastic/Adapters/Base.html +74 -67
- data/doc/classes/Cachetastic/Adapters/Drb.html +11 -11
- data/doc/classes/Cachetastic/Adapters/File.html +5 -5
- data/doc/classes/Cachetastic/Adapters/FileBase.html +45 -45
- data/doc/classes/Cachetastic/Adapters/HtmlFile.html +23 -23
- data/doc/classes/Cachetastic/Adapters/LocalMemory.html +51 -51
- data/doc/classes/Cachetastic/Adapters/Memcache.html +89 -89
- data/doc/classes/Cachetastic/Cacheable.html +22 -22
- data/doc/classes/Cachetastic/Cacheable/ClassAndInstanceMethods.html +23 -23
- data/doc/classes/Cachetastic/Cacheable/ClassOnlyMethods.html +23 -23
- data/doc/classes/Cachetastic/Caches/Base.html +170 -199
- data/doc/classes/Cachetastic/Caches/Base/RegisteredCaches.html +9 -9
- data/doc/classes/Cachetastic/Caches/MackSessionCache.html +2 -2
- data/doc/classes/Cachetastic/Caches/PageCache.html +2 -2
- data/doc/classes/Cachetastic/Caches/RailsSessionCache.html +9 -9
- data/doc/classes/Cachetastic/Connection.html +5 -5
- data/doc/classes/Cachetastic/Errors/UnsupportedAdapter.html +9 -9
- data/doc/classes/Cachetastic/Logger.html +23 -24
- data/doc/classes/Object.html +41 -3
- data/doc/created.rid +1 -1
- data/doc/files/README.html +33 -52
- data/doc/files/lib/{adapters/cachetastic_adapters_base_rb.html → cachetastic/adapters/base_rb.html} +6 -6
- data/doc/files/lib/{adapters/cachetastic_adapters_drb_rb.html → cachetastic/adapters/drb_rb.html} +5 -5
- data/doc/files/lib/{adapters/cachetastic_adapters_file_base_rb.html → cachetastic/adapters/file_base_rb.html} +5 -5
- data/doc/files/lib/{adapters/cachetastic_adapters_file_rb.html → cachetastic/adapters/file_rb.html} +5 -5
- data/doc/files/lib/{adapters/cachetastic_adapters_html_file_rb.html → cachetastic/adapters/html_file_rb.html} +5 -5
- data/doc/files/lib/{adapters/cachetastic_adapters_local_memory_rb.html → cachetastic/adapters/local_memory_rb.html} +5 -5
- data/doc/files/lib/{adapters/cachetastic_adapters_memcache_rb.html → cachetastic/adapters/memcache_rb.html} +5 -5
- data/doc/files/lib/{cachetastic_cacheable_rb.html → cachetastic/adapters/store_object_rb.html} +5 -5
- data/doc/files/lib/{ruby_extensions/object_rb.html → cachetastic/cacheable_rb.html} +4 -4
- data/doc/files/lib/{caches/cachetastic_caches_base_rb.html → cachetastic/caches/base_rb.html} +5 -5
- data/doc/files/lib/{cachetastic_connection_rb.html → cachetastic/caches/mack_session_cache_rb.html} +6 -6
- data/doc/files/lib/{caches/cachetastic_caches_page_cache_rb.html → cachetastic/caches/page_cache_rb.html} +5 -5
- data/doc/files/lib/{caches/cachetastic_caches_rails_session_cache_rb.html → cachetastic/caches/rails_session_cache_rb.html} +5 -5
- data/doc/files/lib/{caches/cachetastic_caches_mack_session_cache_rb.html → cachetastic/connection_rb.html} +5 -5
- data/doc/files/lib/{adapters/cachetastic_adapters_store_object_rb.html → cachetastic/errors/unsupported_adapter_rb.html} +5 -5
- data/doc/files/lib/{cachetastic_logger_rb.html → cachetastic/logger_rb.html} +5 -5
- data/doc/files/lib/{rails_extensions/cachetastic_active_record_base_rb.html → cachetastic/rails_extensions/active_record_base_rb.html} +5 -5
- data/doc/files/lib/{rails_extensions/cgi_session_cachetastic_store_rb.html → cachetastic/rails_extensions/cgi_session_store_rb.html} +5 -5
- data/doc/files/lib/cachetastic/ruby_extensions/object_rb.html +101 -0
- data/doc/files/lib/cachetastic_rb.html +34 -53
- data/doc/fr_file_index.html +19 -19
- data/doc/fr_method_index.html +63 -62
- data/lib/cachetastic.rb +35 -22
- data/lib/{adapters/cachetastic_adapters_base.rb → cachetastic/adapters/base.rb} +23 -30
- data/lib/{adapters/cachetastic_adapters_drb.rb → cachetastic/adapters/drb.rb} +2 -2
- data/lib/{adapters/cachetastic_adapters_file.rb → cachetastic/adapters/file.rb} +0 -0
- data/lib/{adapters/cachetastic_adapters_file_base.rb → cachetastic/adapters/file_base.rb} +1 -1
- data/lib/{adapters/cachetastic_adapters_html_file.rb → cachetastic/adapters/html_file.rb} +0 -0
- data/lib/{adapters/cachetastic_adapters_local_memory.rb → cachetastic/adapters/local_memory.rb} +0 -0
- data/lib/{adapters/cachetastic_adapters_memcache.rb → cachetastic/adapters/memcache.rb} +3 -3
- data/lib/{adapters/cachetastic_adapters_store_object.rb → cachetastic/adapters/store_object.rb} +0 -0
- data/lib/{cachetastic_cacheable.rb → cachetastic/cacheable.rb} +0 -0
- data/lib/{caches/cachetastic_caches_base.rb → cachetastic/caches/base.rb} +11 -13
- data/lib/{caches/cachetastic_caches_mack_session_cache.rb → cachetastic/caches/mack_session_cache.rb} +0 -0
- data/lib/{caches/cachetastic_caches_page_cache.rb → cachetastic/caches/page_cache.rb} +0 -0
- data/lib/{caches/cachetastic_caches_rails_session_cache.rb → cachetastic/caches/rails_session_cache.rb} +0 -0
- data/lib/{cachetastic_connection.rb → cachetastic/connection.rb} +1 -1
- data/lib/{errors/cachetastic_errors_unsupported_adapter.rb → cachetastic/errors/unsupported_adapter.rb} +0 -0
- data/lib/cachetastic/logger.rb +49 -0
- data/lib/{rails_extensions/cachetastic_active_record_base.rb → cachetastic/rails_extensions/active_record_base.rb} +0 -0
- data/lib/{rails_extensions/cgi_session_cachetastic_store.rb → cachetastic/rails_extensions/cgi_session_store.rb} +0 -0
- data/lib/{ruby_extensions → cachetastic/ruby_extensions}/object.rb +0 -0
- data/test/config.rb +30 -0
- data/test/drb_adapter_test.rb +14 -0
- data/test/memcache_adapter_test.rb +14 -0
- data/test/test_helper.rb +8 -22
- metadata +58 -47
- data/doc/files/lib/errors/cachetastic_errors_unsupported_adapter_rb.html +0 -101
- data/lib/cachetastic_logger.rb +0 -44
- data/test/config.yml +0 -71
- data/test/data_mapper_test.rb +0 -9
data/README
CHANGED
|
@@ -1,61 +1,48 @@
|
|
|
1
1
|
=Configuration:
|
|
2
2
|
|
|
3
|
-
cachetastic_default_options:
|
|
4
3
|
# this will dump into the log, configuration info for each cache, as well as the .inspect
|
|
5
4
|
# for each object returned from the cache
|
|
6
|
-
debug
|
|
5
|
+
configatron.cachetastic_default_options.debug = false
|
|
6
|
+
|
|
7
7
|
# this is the type of file store to be used for this cache.
|
|
8
8
|
# more adapters can be developed and plugged in as desired
|
|
9
|
-
adapter:
|
|
9
|
+
configatron.cachetastic_default_options.adapter = :local_memory # local_memory | memcache | file | drb | html_file (default: local_memory)
|
|
10
|
+
|
|
10
11
|
# this will marshall objects into and out of the store.
|
|
11
|
-
marshall_method:
|
|
12
|
+
configatron.cachetastic_default_options.marshall_method = :none # none | yaml | ruby (default: none)
|
|
13
|
+
|
|
12
14
|
# this sets how long objects will live in the cache before they are auto expired.
|
|
13
|
-
default_expiry
|
|
15
|
+
configatron.cachetastic_default_options.default_expiry = 86400 # time in seconds (default: 24 hours)
|
|
16
|
+
|
|
14
17
|
# when setting objects into the cache the expiry_swing is +/- to the expiry time.
|
|
15
18
|
# example: if the expiry time is 1 hour, and the swing is 15 minutes,
|
|
16
19
|
# objects will go into the cache with an expiry time sometime between 45 mins and 75 mins.
|
|
17
|
-
expiry_swing
|
|
20
|
+
configatron.cachetastic_default_options.expiry_swing = 60 * 15 # time in seconds (default: 0)
|
|
21
|
+
|
|
18
22
|
# these options get passed on directly to the store.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
dir: /cachetastic/caches/ # absolute path to the directory where caches should be stored.
|
|
27
|
-
store_options: # listed below are the options for drb
|
|
28
|
-
host: "druby://127.0.0.1:61676"
|
|
29
|
-
# configure logging for this cache:
|
|
30
|
-
logging:
|
|
31
|
-
# n number of logs can be configured for a cache
|
|
32
|
-
# their names can be anything you want, it's doesn't matter
|
|
33
|
-
logger_1:
|
|
34
|
-
# this sets the type of log you want to write to.
|
|
35
|
-
# right now the only two options are file and console
|
|
36
|
-
type: file # console | file (default: none)
|
|
37
|
-
# if the type is file, you need to configure where the log file is to be written.
|
|
38
|
-
file: log/memcached.log # relative | absolute path to log file
|
|
39
|
-
# this sets the level of logging for this cache
|
|
40
|
-
level: info # debug | info | warn | error | fatal (default: info)
|
|
41
|
-
logger_2:
|
|
42
|
-
# this sets the type of log you want to write to.
|
|
43
|
-
# right now the only two options are file and console
|
|
44
|
-
type: console # console | file (default: none)
|
|
45
|
-
# this sets the level of logging for this cache
|
|
46
|
-
level: error # debug | info | warn | error | fatal (default: info)
|
|
23
|
+
# listed below are options for memcache:
|
|
24
|
+
configatron.cachetastic_default_options.store_options.c_threshold = "10_000"
|
|
25
|
+
configatron.cachetastic_default_options.store_options.compression = true
|
|
26
|
+
configatron.cachetastic_default_options.store_options.debug = false
|
|
27
|
+
configatron.cachetastic_default_options.store_options.readonly = false
|
|
28
|
+
configatron.cachetastic_default_options.store_options.urlencode = false
|
|
29
|
+
|
|
47
30
|
# set the servers to be used for memcache
|
|
48
|
-
servers:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
31
|
+
configatron.cachetastic_default_options.servers = ["127.0.0.1:11211"] # ip:port used for memcache
|
|
32
|
+
|
|
33
|
+
# listed below are the options for file:
|
|
34
|
+
configatron.cachetastic_default_options.store_options.dir = "/cachetastic/caches"
|
|
35
|
+
|
|
36
|
+
# listed below are the options for drb:
|
|
37
|
+
configatron.cachetastic_default_options.servers = ["druby://127.0.0.1:61676"]
|
|
55
38
|
|
|
56
|
-
#
|
|
57
|
-
|
|
58
|
-
|
|
39
|
+
# configure logging for this cache
|
|
40
|
+
# n number of logs can be configured for a cache
|
|
41
|
+
log_1 = Logger.new(STDOUT)
|
|
42
|
+
log_1.level = Logger::DEBUG
|
|
43
|
+
log_2 = Logger.new("log/cachetastic.log")
|
|
44
|
+
log_2.level = Logger::ERROR
|
|
45
|
+
configatron.cachetastic_default_options.logger = [log_1, log_2]
|
|
59
46
|
|
|
60
47
|
=Cachetastic::Drb::Server
|
|
61
48
|
If you want to use Drb and the Cachetastic::Adapters::Drb adapter, you'll have to use the Cachetastic::Drb::Server that comes with Cachetastic. Using this server is simple. It gets installed as a binary when you install the Cachetastic gem.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
#!/usr/local/bin/ruby
|
|
2
|
+
require 'thread'
|
|
3
|
+
require 'drb'
|
|
4
|
+
require 'singleton'
|
|
5
|
+
require 'optparse'
|
|
6
|
+
require 'optparse/time'
|
|
7
|
+
require 'ostruct'
|
|
8
|
+
|
|
9
|
+
# require the necessary gems:
|
|
10
|
+
require 'rubygems'
|
|
11
|
+
gem 'mack-facets'
|
|
12
|
+
require 'mack-facets'
|
|
13
|
+
gem 'configatron'
|
|
14
|
+
require 'configatron'
|
|
15
|
+
gem 'cachetastic'
|
|
16
|
+
require 'cachetastic'
|
|
17
|
+
|
|
18
|
+
$SAFE = 1
|
|
19
|
+
|
|
20
|
+
SERVER_OPTIONS = OpenStruct.new
|
|
21
|
+
SERVER_OPTIONS.host = "127.0.0.1"
|
|
22
|
+
SERVER_OPTIONS.port = "61676"
|
|
23
|
+
SERVER_OPTIONS.config_file = nil
|
|
24
|
+
SERVER_OPTIONS.verbose = false
|
|
25
|
+
SERVER_OPTIONS.really_verbose = false
|
|
26
|
+
|
|
27
|
+
opts = OptionParser.new do |opts|
|
|
28
|
+
|
|
29
|
+
opts.on("-h [HOST]") do |v|
|
|
30
|
+
SERVER_OPTIONS.host = v
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
opts.on("-p [PORT]", Integer) do |v|
|
|
34
|
+
SERVER_OPTIONS.port = v
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
opts.on("-c [CONFIG_FILE]") do |v|
|
|
38
|
+
SERVER_OPTIONS.config_file = v
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
opts.on("-v") do |v|
|
|
42
|
+
SERVER_OPTIONS.verbose = true
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
opts.on("-rv") do |v|
|
|
46
|
+
SERVER_OPTIONS.verbose = true
|
|
47
|
+
SERVER_OPTIONS.really_verbose = true
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
opts.parse!(ARGV)
|
|
53
|
+
|
|
54
|
+
if SERVER_OPTIONS.config_file
|
|
55
|
+
configatron.configure_from_yaml(SERVER_OPTIONS.config_file)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
module Cachetastic
|
|
59
|
+
module Drb
|
|
60
|
+
class Server
|
|
61
|
+
include Singleton
|
|
62
|
+
|
|
63
|
+
def initialize
|
|
64
|
+
DRb.start_service("druby://#{SERVER_OPTIONS.host}:#{SERVER_OPTIONS.port}", self)
|
|
65
|
+
puts "Cachetastic::Drb::Server listening for connection..."
|
|
66
|
+
DRb.thread.join
|
|
67
|
+
end # initialize
|
|
68
|
+
|
|
69
|
+
def get(ns, key)
|
|
70
|
+
puts "get: #{ns}.#{key}" if SERVER_OPTIONS.verbose
|
|
71
|
+
puts cache_for_namespace(ns).inspect if SERVER_OPTIONS.really_verbose
|
|
72
|
+
value = cache_for_namespace(ns).get(key)
|
|
73
|
+
puts "\tvalue.class: #{value.class}" if SERVER_OPTIONS.verbose
|
|
74
|
+
value
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def set(ns, key, value, expiry = 0)
|
|
78
|
+
puts "set: #{ns}.#{key}: #{value}" if SERVER_OPTIONS.verbose
|
|
79
|
+
cache_for_namespace(ns).set(key, value)
|
|
80
|
+
puts cache_for_namespace(ns).inspect if SERVER_OPTIONS.really_verbose
|
|
81
|
+
value
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def delete(ns, key, delay = 0)
|
|
85
|
+
puts "delete: #{ns}.#{key}" if SERVER_OPTIONS.verbose
|
|
86
|
+
cache_for_namespace(ns).delete(key, delay = 0)
|
|
87
|
+
puts cache_for_namespace(ns).inspect if SERVER_OPTIONS.really_verbose
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def expire_all(ns)
|
|
91
|
+
puts "expire_all: #{ns}" if SERVER_OPTIONS.verbose
|
|
92
|
+
instance_variable_set("@store_for_#{ns}", Cachetastic::Adapters::LocalMemory.new("store_for_#{ns}"))
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def ping
|
|
96
|
+
true
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
private
|
|
100
|
+
def cache_for_namespace(ns)
|
|
101
|
+
# puts "@store_for_#{ns}"
|
|
102
|
+
c = instance_variable_get("@store_for_#{ns}")
|
|
103
|
+
if c.nil?
|
|
104
|
+
instance_variable_set("@store_for_#{ns}", Cachetastic::Adapters::LocalMemory.new("store_for_#{ns}"))
|
|
105
|
+
c = instance_variable_get("@store_for_#{ns}")
|
|
106
|
+
end
|
|
107
|
+
c
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
end # Server
|
|
111
|
+
end # Drb
|
|
112
|
+
end # Cachetastic
|
|
113
|
+
|
|
114
|
+
# let's start `er up!
|
|
115
|
+
Cachetastic::Drb::Server.instance
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
<tr class="top-aligned-row">
|
|
56
56
|
<td><strong>In:</strong></td>
|
|
57
57
|
<td>
|
|
58
|
-
<a href="../../files/lib/rails_extensions/
|
|
59
|
-
lib/rails_extensions/
|
|
58
|
+
<a href="../../files/lib/cachetastic/rails_extensions/active_record_base_rb.html">
|
|
59
|
+
lib/cachetastic/rails_extensions/active_record_base.rb
|
|
60
60
|
</a>
|
|
61
61
|
<br />
|
|
62
62
|
</td>
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
<h3 class="section-bar">Methods</h3>
|
|
89
89
|
|
|
90
90
|
<div class="name-list">
|
|
91
|
-
<a href="#
|
|
92
|
-
<a href="#
|
|
91
|
+
<a href="#M000074">cachetastic_key</a>
|
|
92
|
+
<a href="#M000075">get_from_cache</a>
|
|
93
93
|
</div>
|
|
94
94
|
</div>
|
|
95
95
|
|
|
@@ -118,11 +118,11 @@
|
|
|
118
118
|
<div id="methods">
|
|
119
119
|
<h3 class="section-bar">Public Class methods</h3>
|
|
120
120
|
|
|
121
|
-
<div id="method-
|
|
122
|
-
<a name="
|
|
121
|
+
<div id="method-M000075" class="method-detail">
|
|
122
|
+
<a name="M000075"></a>
|
|
123
123
|
|
|
124
124
|
<div class="method-heading">
|
|
125
|
-
<a href="#
|
|
125
|
+
<a href="#M000075" class="method-signature">
|
|
126
126
|
<span class="method-name">get_from_cache</span><span class="method-args">(key, self_populate = false)</span>
|
|
127
127
|
</a>
|
|
128
128
|
</div>
|
|
@@ -135,10 +135,10 @@ try and find the object in the database, set the object into the cache, and
|
|
|
135
135
|
then return the object.
|
|
136
136
|
</p>
|
|
137
137
|
<p><a class="source-toggle" href="#"
|
|
138
|
-
onclick="toggleCode('
|
|
139
|
-
<div class="method-source-code" id="
|
|
138
|
+
onclick="toggleCode('M000075-source');return false;">[Source]</a></p>
|
|
139
|
+
<div class="method-source-code" id="M000075-source">
|
|
140
140
|
<pre>
|
|
141
|
-
<span class="ruby-comment cmt"># File lib/rails_extensions/
|
|
141
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/rails_extensions/active_record_base.rb, line 13</span>
|
|
142
142
|
13: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_from_cache</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">self_populate</span> = <span class="ruby-keyword kw">false</span>)
|
|
143
143
|
14: <span class="ruby-identifier">res</span> = <span class="ruby-identifier">cache_class</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">key</span>)
|
|
144
144
|
15: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">self_populate</span>
|
|
@@ -156,21 +156,21 @@ then return the object.
|
|
|
156
156
|
|
|
157
157
|
<h3 class="section-bar">Public Instance methods</h3>
|
|
158
158
|
|
|
159
|
-
<div id="method-
|
|
160
|
-
<a name="
|
|
159
|
+
<div id="method-M000074" class="method-detail">
|
|
160
|
+
<a name="M000074"></a>
|
|
161
161
|
|
|
162
162
|
<div class="method-heading">
|
|
163
|
-
<a href="#
|
|
163
|
+
<a href="#M000074" class="method-signature">
|
|
164
164
|
<span class="method-name">cachetastic_key</span><span class="method-args">()</span>
|
|
165
165
|
</a>
|
|
166
166
|
</div>
|
|
167
167
|
|
|
168
168
|
<div class="method-description">
|
|
169
169
|
<p><a class="source-toggle" href="#"
|
|
170
|
-
onclick="toggleCode('
|
|
171
|
-
<div class="method-source-code" id="
|
|
170
|
+
onclick="toggleCode('M000074-source');return false;">[Source]</a></p>
|
|
171
|
+
<div class="method-source-code" id="M000074-source">
|
|
172
172
|
<pre>
|
|
173
|
-
<span class="ruby-comment cmt"># File lib/rails_extensions/
|
|
173
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/rails_extensions/active_record_base.rb, line 5</span>
|
|
174
174
|
5: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cachetastic_key</span>
|
|
175
175
|
6: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">id</span>
|
|
176
176
|
7: <span class="ruby-keyword kw">end</span>
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
<tr class="top-aligned-row">
|
|
56
56
|
<td><strong>In:</strong></td>
|
|
57
57
|
<td>
|
|
58
|
-
<a href="../../../files/lib/rails_extensions/
|
|
59
|
-
lib/rails_extensions/
|
|
58
|
+
<a href="../../../files/lib/cachetastic/rails_extensions/cgi_session_store_rb.html">
|
|
59
|
+
lib/cachetastic/rails_extensions/cgi_session_store.rb
|
|
60
60
|
</a>
|
|
61
61
|
<br />
|
|
62
62
|
</td>
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
<tr class="top-aligned-row">
|
|
56
56
|
<td><strong>In:</strong></td>
|
|
57
57
|
<td>
|
|
58
|
-
<a href="../../../files/lib/adapters/
|
|
59
|
-
lib/adapters/
|
|
58
|
+
<a href="../../../files/lib/cachetastic/adapters/base_rb.html">
|
|
59
|
+
lib/cachetastic/adapters/base.rb
|
|
60
60
|
</a>
|
|
61
61
|
<br />
|
|
62
62
|
</td>
|
|
@@ -107,11 +107,11 @@ the store supports it, a delay can be used.
|
|
|
107
107
|
<li>expire_all - expires all objects in the store for a given cache.
|
|
108
108
|
|
|
109
109
|
</li>
|
|
110
|
-
<li><a href="Base.html#
|
|
110
|
+
<li><a href="Base.html#M000034">stats</a> - returns statistics for the store.
|
|
111
111
|
|
|
112
112
|
</li>
|
|
113
113
|
<li>valid? - used to test whether or not the store is still valid. If this
|
|
114
|
-
returns false a <a href="Base.html#
|
|
114
|
+
returns false a <a href="Base.html#M000032">new</a> instance of the adapter
|
|
115
115
|
is created by <a href="../Connection.html">Cachetastic::Connection</a>
|
|
116
116
|
|
|
117
117
|
</li>
|
|
@@ -126,10 +126,11 @@ is created by <a href="../Connection.html">Cachetastic::Connection</a>
|
|
|
126
126
|
<h3 class="section-bar">Methods</h3>
|
|
127
127
|
|
|
128
128
|
<div class="name-list">
|
|
129
|
-
<a href="#
|
|
130
|
-
<a href="#
|
|
131
|
-
<a href="#M000033">
|
|
132
|
-
<a href="#
|
|
129
|
+
<a href="#M000036">configuration</a>
|
|
130
|
+
<a href="#M000035">configuration</a>
|
|
131
|
+
<a href="#M000033">debug?</a>
|
|
132
|
+
<a href="#M000032">new</a>
|
|
133
|
+
<a href="#M000034">stats</a>
|
|
133
134
|
</div>
|
|
134
135
|
</div>
|
|
135
136
|
|
|
@@ -149,35 +150,21 @@ is created by <a href="../Connection.html">Cachetastic::Connection</a>
|
|
|
149
150
|
|
|
150
151
|
<div class="name-list">
|
|
151
152
|
<table>
|
|
152
|
-
<tr class="top-aligned-row context-row">
|
|
153
|
-
<td class="context-item-name">all_options</td>
|
|
154
|
-
<td class="context-item-value"> [R] </td>
|
|
155
|
-
<td class="context-item-desc"></td>
|
|
156
|
-
</tr>
|
|
157
153
|
<tr class="top-aligned-row context-row">
|
|
158
154
|
<td class="context-item-name">logger</td>
|
|
159
155
|
<td class="context-item-value"> [R] </td>
|
|
160
|
-
<td class="context-item-desc"
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
<td class="context-item-value"> [R] </td>
|
|
165
|
-
<td class="context-item-desc"></td>
|
|
156
|
+
<td class="context-item-desc">
|
|
157
|
+
attr_reader :logging
|
|
158
|
+
|
|
159
|
+
</td>
|
|
166
160
|
</tr>
|
|
167
161
|
<tr class="top-aligned-row context-row">
|
|
168
162
|
<td class="context-item-name">name</td>
|
|
169
163
|
<td class="context-item-value"> [R] </td>
|
|
170
|
-
<td class="context-item-desc"
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
<td class="context-item-value"> [R] </td>
|
|
175
|
-
<td class="context-item-desc"></td>
|
|
176
|
-
</tr>
|
|
177
|
-
<tr class="top-aligned-row context-row">
|
|
178
|
-
<td class="context-item-name">store_options</td>
|
|
179
|
-
<td class="context-item-value"> [R] </td>
|
|
180
|
-
<td class="context-item-desc"></td>
|
|
164
|
+
<td class="context-item-desc">
|
|
165
|
+
attr_reader :all_options attr_reader :store_options attr_reader :servers
|
|
166
|
+
|
|
167
|
+
</td>
|
|
181
168
|
</tr>
|
|
182
169
|
</table>
|
|
183
170
|
</div>
|
|
@@ -194,16 +181,15 @@ is created by <a href="../Connection.html">Cachetastic::Connection</a>
|
|
|
194
181
|
|
|
195
182
|
<div class="method-heading">
|
|
196
183
|
<a href="#M000036" class="method-signature">
|
|
197
|
-
<span class="method-name">
|
|
184
|
+
<span class="method-name">configuration</span><span class="method-args">(name)</span>
|
|
198
185
|
</a>
|
|
199
186
|
</div>
|
|
200
187
|
|
|
201
188
|
<div class="method-description">
|
|
202
189
|
<p>
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
methodized name of the cache with _options attached at the end. Examples:
|
|
190
|
+
Returns either the options Options need to be specified in configatrion as
|
|
191
|
+
the methodized name of the cache with _options attached at the end.
|
|
192
|
+
Examples:
|
|
207
193
|
</p>
|
|
208
194
|
<pre>
|
|
209
195
|
Cachetastic::Caches::PageCache # => cachetastic_caches_page_cache_options
|
|
@@ -213,42 +199,40 @@ methodized name of the cache with _options attached at the end. Examples:
|
|
|
213
199
|
onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
|
|
214
200
|
<div class="method-source-code" id="M000036-source">
|
|
215
201
|
<pre>
|
|
216
|
-
<span class="ruby-comment cmt"># File lib/adapters/
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
73: <span class="ruby-keyword kw">end</span>
|
|
202
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/adapters/base.rb, line 71</span>
|
|
203
|
+
71: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">configuration</span>(<span class="ruby-identifier">name</span>)
|
|
204
|
+
72: <span class="ruby-identifier">name</span> = <span class="ruby-node">"#{name}_options"</span>
|
|
205
|
+
73: <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
|
+
74: <span class="ruby-identifier">conf</span>
|
|
207
|
+
75: <span class="ruby-keyword kw">end</span>
|
|
223
208
|
</pre>
|
|
224
209
|
</div>
|
|
225
210
|
</div>
|
|
226
211
|
</div>
|
|
227
212
|
|
|
228
|
-
<div id="method-
|
|
229
|
-
<a name="
|
|
213
|
+
<div id="method-M000032" class="method-detail">
|
|
214
|
+
<a name="M000032"></a>
|
|
230
215
|
|
|
231
216
|
<div class="method-heading">
|
|
232
|
-
<a href="#
|
|
217
|
+
<a href="#M000032" class="method-signature">
|
|
233
218
|
<span class="method-name">new</span><span class="method-args">(name)</span>
|
|
234
219
|
</a>
|
|
235
220
|
</div>
|
|
236
221
|
|
|
237
222
|
<div class="method-description">
|
|
238
223
|
<p><a class="source-toggle" href="#"
|
|
239
|
-
onclick="toggleCode('
|
|
240
|
-
<div class="method-source-code" id="
|
|
224
|
+
onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
|
|
225
|
+
<div class="method-source-code" id="M000032-source">
|
|
241
226
|
<pre>
|
|
242
|
-
<span class="ruby-comment cmt"># File lib/adapters/
|
|
227
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/adapters/base.rb, line 24</span>
|
|
243
228
|
24: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span>)
|
|
244
229
|
25: <span class="ruby-ivar">@name</span> = <span class="ruby-identifier">name</span>
|
|
245
|
-
26: <span class="ruby-identifier">
|
|
230
|
+
26: <span class="ruby-ivar">@logger</span> = <span class="ruby-constant">Cachetastic</span><span class="ruby-operator">::</span><span class="ruby-constant">Logger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">configuration</span>.<span class="ruby-identifier">retrieve</span>(<span class="ruby-identifier">:logger</span>, <span class="ruby-operator">::</span><span class="ruby-constant">Logger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">STDOUT</span>)))
|
|
246
231
|
27: <span class="ruby-identifier">setup</span>
|
|
247
232
|
28: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">debug?</span>
|
|
248
233
|
29: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">name</span>, <span class="ruby-identifier">:self</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">inspect</span>)
|
|
249
|
-
30:
|
|
250
|
-
31:
|
|
251
|
-
32: <span class="ruby-keyword kw">end</span>
|
|
234
|
+
30: <span class="ruby-keyword kw">end</span>
|
|
235
|
+
31: <span class="ruby-keyword kw">end</span>
|
|
252
236
|
</pre>
|
|
253
237
|
</div>
|
|
254
238
|
</div>
|
|
@@ -256,11 +240,34 @@ methodized name of the cache with _options attached at the end. Examples:
|
|
|
256
240
|
|
|
257
241
|
<h3 class="section-bar">Public Instance methods</h3>
|
|
258
242
|
|
|
259
|
-
<div id="method-
|
|
260
|
-
<a name="
|
|
243
|
+
<div id="method-M000035" class="method-detail">
|
|
244
|
+
<a name="M000035"></a>
|
|
261
245
|
|
|
262
246
|
<div class="method-heading">
|
|
263
|
-
<a href="#
|
|
247
|
+
<a href="#M000035" class="method-signature">
|
|
248
|
+
<span class="method-name">configuration</span><span class="method-args">()</span>
|
|
249
|
+
</a>
|
|
250
|
+
</div>
|
|
251
|
+
|
|
252
|
+
<div class="method-description">
|
|
253
|
+
<p><a class="source-toggle" href="#"
|
|
254
|
+
onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
|
|
255
|
+
<div class="method-source-code" id="M000035-source">
|
|
256
|
+
<pre>
|
|
257
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/adapters/base.rb, line 60</span>
|
|
258
|
+
60: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">configuration</span>
|
|
259
|
+
61: <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
|
+
62: <span class="ruby-keyword kw">end</span>
|
|
261
|
+
</pre>
|
|
262
|
+
</div>
|
|
263
|
+
</div>
|
|
264
|
+
</div>
|
|
265
|
+
|
|
266
|
+
<div id="method-M000033" class="method-detail">
|
|
267
|
+
<a name="M000033"></a>
|
|
268
|
+
|
|
269
|
+
<div class="method-heading">
|
|
270
|
+
<a href="#M000033" class="method-signature">
|
|
264
271
|
<span class="method-name">debug?</span><span class="method-args">()</span>
|
|
265
272
|
</a>
|
|
266
273
|
</div>
|
|
@@ -268,17 +275,17 @@ methodized name of the cache with _options attached at the end. Examples:
|
|
|
268
275
|
<div class="method-description">
|
|
269
276
|
<p>
|
|
270
277
|
Returns true/or falsed based on whether or not the debug setting is set to
|
|
271
|
-
true in the configuration file. If the
|
|
272
|
-
returned.
|
|
278
|
+
true in the <a href="Base.html#M000035">configuration</a> file. If the
|
|
279
|
+
config setting is set, then false is returned.
|
|
273
280
|
</p>
|
|
274
281
|
<p><a class="source-toggle" href="#"
|
|
275
|
-
onclick="toggleCode('
|
|
276
|
-
<div class="method-source-code" id="
|
|
282
|
+
onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
|
|
283
|
+
<div class="method-source-code" id="M000033-source">
|
|
277
284
|
<pre>
|
|
278
|
-
<span class="ruby-comment cmt"># File lib/adapters/
|
|
285
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/adapters/base.rb, line 43</span>
|
|
279
286
|
43: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">debug?</span>
|
|
280
287
|
44: <span class="ruby-identifier">ivar_cache</span>(<span class="ruby-identifier">:debug</span>) <span class="ruby-keyword kw">do</span>
|
|
281
|
-
45:
|
|
288
|
+
45: <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>)
|
|
282
289
|
46: <span class="ruby-keyword kw">end</span>
|
|
283
290
|
47: <span class="ruby-keyword kw">end</span>
|
|
284
291
|
</pre>
|
|
@@ -286,21 +293,21 @@ returned.
|
|
|
286
293
|
</div>
|
|
287
294
|
</div>
|
|
288
295
|
|
|
289
|
-
<div id="method-
|
|
290
|
-
<a name="
|
|
296
|
+
<div id="method-M000034" class="method-detail">
|
|
297
|
+
<a name="M000034"></a>
|
|
291
298
|
|
|
292
299
|
<div class="method-heading">
|
|
293
|
-
<a href="#
|
|
300
|
+
<a href="#M000034" class="method-signature">
|
|
294
301
|
<span class="method-name">stats</span><span class="method-args">()</span>
|
|
295
302
|
</a>
|
|
296
303
|
</div>
|
|
297
304
|
|
|
298
305
|
<div class="method-description">
|
|
299
306
|
<p><a class="source-toggle" href="#"
|
|
300
|
-
onclick="toggleCode('
|
|
301
|
-
<div class="method-source-code" id="
|
|
307
|
+
onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
|
|
308
|
+
<div class="method-source-code" id="M000034-source">
|
|
302
309
|
<pre>
|
|
303
|
-
<span class="ruby-comment cmt"># File lib/adapters/
|
|
310
|
+
<span class="ruby-comment cmt"># File lib/cachetastic/adapters/base.rb, line 49</span>
|
|
304
311
|
49: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stats</span>
|
|
305
312
|
50: <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>
|
|
306
313
|
51: <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>)
|