thorero-cache 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,168 @@
1
+ class Merb::Cache::MemoryStore
2
+ # Provides the memory cache store for merb-cache
3
+
4
+ def initialize
5
+ @config = Merb::Controller._cache.config
6
+ @cache = {}
7
+ @mutex = Mutex.new
8
+ prepare
9
+ end
10
+
11
+ # This method is there to ensure minimal requirements are met
12
+ # (directories are accessible, table exists, connected to server, ...)
13
+ def prepare
14
+ true
15
+ end
16
+
17
+ # Checks whether a cache entry exists
18
+ #
19
+ # ==== Parameter
20
+ # key<String>:: The key identifying the cache entry
21
+ #
22
+ # ==== Returns
23
+ # true if the cache entry exists, false otherwise
24
+ def cached?(key)
25
+ if @cache.key?(key)
26
+ _data, _expire = *cache_read(key)
27
+ return true if _expire.nil? || Time.now < _expire
28
+ expire(key)
29
+ end
30
+ false
31
+ end
32
+
33
+ # Capture or restore the data in cache.
34
+ # If the cache entry expired or does not exist, the data are taken
35
+ # from the execution of the block, marshalled and stored in cache.
36
+ # Otherwise, the data are loaded from the cache and returned unmarshalled
37
+ #
38
+ # ==== Parameters
39
+ # _controller<Merb::Controller>:: The instance of the current controller
40
+ # key<String>:: The key identifying the cache entry
41
+ # from_now<~minutes>::
42
+ # The number of minutes (from now) the cache should persist
43
+ # &block:: The template to be used or not
44
+ #
45
+ # ==== Additional information
46
+ # When fetching data (the cache entry exists and has not expired)
47
+ # The data are loaded from the cache and returned unmarshalled.
48
+ # Otherwise:
49
+ # The controller is used to capture the rendered template (from the block).
50
+ # It uses the capture_#{engine} and concat_#{engine} methods to do so.
51
+ # The captured data are then marshalled and stored.
52
+ def cache(_controller, key, from_now = nil, &block)
53
+ if @cache.key?(key)
54
+ _data, _expire = *cache_read(key)
55
+ _cache_hit = _expire.nil? || Time.now < _expire
56
+ end
57
+ unless _cache_hit
58
+ _expire = from_now ? from_now.minutes.from_now : nil
59
+ _data = _controller.send(:capture, &block)
60
+ cache_write(key, [_data, _expire])
61
+ end
62
+ _controller.send(:concat, _data, block.binding)
63
+ true
64
+ end
65
+
66
+ # Store data to the file using the specified key
67
+ #
68
+ # ==== Parameters
69
+ # key<Sting>:: The key identifying the cache entry
70
+ # data<String>:: The data to be put in cache
71
+ # from_now<~minutes>::
72
+ # The number of minutes (from now) the cache should persist
73
+ def cache_set(key, data, from_now = nil)
74
+ _expire = from_now ? from_now.minutes.from_now : nil
75
+ cache_write(key, [data, _expire])
76
+ Merb.logger.info("cache: set (#{key})")
77
+ true
78
+ end
79
+
80
+ # Fetch data from the file using the specified key
81
+ # The entry is deleted if it has expired
82
+ #
83
+ # ==== Parameter
84
+ # key<Sting>:: The key identifying the cache entry
85
+ #
86
+ # ==== Returns
87
+ # data<String, NilClass>::
88
+ # nil is returned whether the entry expired or was not found
89
+ def cache_get(key)
90
+ if @cache.key?(key)
91
+ _data, _expire = *cache_read(key)
92
+ if _expire.nil? || Time.now < _expire
93
+ Merb.logger.info("cache: hit (#{key})")
94
+ return _data
95
+ end
96
+ @mutex.synchronize do @cache.delete(key) end
97
+ end
98
+ Merb.logger.info("cache: miss (#{key})")
99
+ nil
100
+ end
101
+
102
+ # Expire the cache entry identified by the given key
103
+ #
104
+ # ==== Parameter
105
+ # key<Sting>:: The key identifying the cache entry
106
+ def expire(key)
107
+ @mutex.synchronize do
108
+ @cache.delete(key)
109
+ end
110
+ Merb.logger.info("cache: expired (#{key})")
111
+ true
112
+ end
113
+
114
+ # Expire the cache entries matching the given key
115
+ #
116
+ # ==== Parameter
117
+ # key<Sting>:: The key matching the cache entries
118
+ def expire_match(key)
119
+ @mutex.synchronize do
120
+ @cache.delete_if do |k,v| k.match(/#{key}/) end
121
+ end
122
+ Merb.logger.info("cache: expired matching (#{key})")
123
+ true
124
+ end
125
+
126
+ # Expire all the cache entries
127
+ def expire_all
128
+ @mutex.synchronize do
129
+ @cache.clear
130
+ end
131
+ Merb.logger.info("cache: expired all")
132
+ true
133
+ end
134
+
135
+ # Gives info on the current cache store
136
+ #
137
+ # ==== Returns
138
+ # The type of the current cache store
139
+ def cache_store_type
140
+ "memory"
141
+ end
142
+
143
+ private
144
+
145
+ # Read data from the memory hash table using mutex
146
+ #
147
+ # ==== Parameters
148
+ # cache_file<String>:: The key identifying the cache entry
149
+ #
150
+ # ==== Returns
151
+ # _data<String>:: The data fetched from the cache
152
+ def cache_read(key)
153
+ @mutex.synchronize do
154
+ @cache[key]
155
+ end
156
+ end
157
+
158
+ # Write data to the memory hash table using mutex
159
+ #
160
+ # ==== Parameters
161
+ # cache_file<String>:: The key identifying the cache entry
162
+ # data<String>:: The data to be put in cache
163
+ def cache_write(key, data)
164
+ @mutex.synchronize do
165
+ @cache[key] = data
166
+ end
167
+ end
168
+ end
@@ -0,0 +1,165 @@
1
+ require "merb-cache/cache-action"
2
+ require "merb-cache/cache-page"
3
+ require "merb-cache/cache-fragment"
4
+
5
+ class Merb::Cache
6
+ attr_reader :config, :store
7
+
8
+ class StoreNotFound < Exception
9
+ def initialize(cache_store)
10
+ super("cache_store (#{cache_store}) not found (not implemented?)")
11
+ end
12
+ end
13
+
14
+ DEFAULT_CONFIG = {
15
+ :cache_html_directory => Merb.dir_for(:public) / "cache",
16
+
17
+ #:store => "database",
18
+ #:table_name => "merb_cache",
19
+
20
+ #:disable => "development", # disable merb-cache in development
21
+ #:disable => true, # disable merb-cache in all environments
22
+
23
+ :store => "file",
24
+ :cache_directory => Merb.root_path("tmp/cache"),
25
+
26
+ #:store => "memcache",
27
+ #:host => "127.0.0.1:11211",
28
+ #:namespace => "merb_cache",
29
+ #:track_keys => true,
30
+
31
+ #:store => "memory",
32
+ # store could be: file, memcache, memory, database, dummy, ...
33
+ }
34
+
35
+ # Called in the after_app_loads loop and instantiate the right backend
36
+ #
37
+ # ==== Raises
38
+ # Store#NotFound::
39
+ # If the cache_store mentionned in the config is unknown
40
+ def start
41
+ @config = DEFAULT_CONFIG.merge(Merb::Plugins.config[:merb_cache] || {})
42
+ if @config[:disable] == true || Merb.environment.to_s == @config[:disable].to_s
43
+ config[:disable_page_caching] = true
44
+ config[:store] = "dummy"
45
+ end
46
+ @config[:cache_html_directory] ||= Merb.dir_for(:public) / "cache"
47
+ require "merb-cache/cache-store/#{@config[:store]}"
48
+ @store = Merb::Cache.const_get("#{@config[:store].capitalize}Store").new
49
+ Merb.logger.info("Using #{@config[:store]} cache")
50
+ rescue LoadError
51
+ raise Merb::Cache::StoreNotFound, @config[:store].inspect
52
+ end
53
+
54
+ # Compute a cache key and yield it to the given block
55
+ # It is used by the #expire_page, #expire_action and #expire methods.
56
+ #
57
+ # ==== Parameters
58
+ # options<String, Hash>:: The key or the Hash that will be used to build the key
59
+ # controller<String>:: The name of the controller
60
+ # controller_based<Boolean>:: only used by action and page caching
61
+ #
62
+ # ==== Options (options)
63
+ # :key<String>:: The complete or partial key that will be computed.
64
+ # :action<String>:: The action name that will be used to compute the key
65
+ # :controller<String>:: The controller name that will be part of the key
66
+ # :params<Array[String]>::
67
+ # The params will be joined together (with '/') and added to the key
68
+ # :match<Boolean, String>::
69
+ # true, it will try to match multiple cache entries
70
+ # string, shortcut for {:key => "mykey", :match => true}
71
+ #
72
+ # ==== Examples
73
+ # expire(:key => "root_key", :params => [session[:me], params[:id]])
74
+ # expire(:match => "root_key")
75
+ # expire_action(:action => 'list')
76
+ # expire_page(:action => 'show', :controller => 'news')
77
+ #
78
+ # ==== Returns
79
+ # The result of the given block
80
+ #
81
+ def expire_key_for(options, controller, controller_based = false)
82
+ key = ""
83
+ if options.is_a? Hash
84
+ case
85
+ when key = options[:key]
86
+ when action = options[:action]
87
+ controller = options[:controller] || controller
88
+ key = "/#{controller}/#{action}"
89
+ when match = options[:match]
90
+ key = match
91
+ end
92
+ if _params = options[:params]
93
+ key += "/" + _params.join("/")
94
+ end
95
+ yield key, !options[:match].nil?
96
+ else
97
+ yield controller_based ? "/#{controller}/#{options}" : options, false
98
+ end
99
+ end
100
+
101
+ # Compute a cache key based on the given parameters
102
+ # Only used by the #cached_page?, #cached_action?, #cached?, #cache,
103
+ # #cache_get and #cache_set methods
104
+ #
105
+ # ==== Parameters
106
+ # options<String, Hash>:: The key or the Hash that will be used to build the key
107
+ # controller<String>:: The name of the controller
108
+ # controller_based<Boolean>:: only used by action and page caching
109
+ #
110
+ # ==== Options (options)
111
+ # :key<String>:: The complete or partial key that will be computed.
112
+ # :action<String>:: The action name that will be used to compute the key
113
+ # :controller<String>:: The controller name that will be part of the key
114
+ # :params<Array[String]>::
115
+ # The params will be joined together (with '/') and added to the key
116
+ #
117
+ # ==== Examples
118
+ # cache_set("my_key", @data)
119
+ # cache_get(:key => "root_key", :params => [session[:me], params[:id]])
120
+ #
121
+ # ==== Returns
122
+ # The computed key
123
+ def key_for(options, controller, controller_based = false)
124
+ key = ""
125
+ if options.is_a? Hash
126
+ case
127
+ when key = options[:key]
128
+ when action = options[:action]
129
+ controller = options[:controller] || controller
130
+ key = "/#{controller}/#{action}"
131
+ end
132
+ if _params = options[:params]
133
+ key += "/" + _params.join("/")
134
+ end
135
+ else
136
+ key = controller_based ? "/#{controller}/#{options}" : options
137
+ end
138
+ key
139
+ end
140
+
141
+ module ControllerInstanceMethods
142
+ # Mixed in Merb::Controller and provides expire_all for action and fragment caching.
143
+ def expire_all
144
+ Merb::Controller._cache.store.expire_all
145
+ end
146
+ end
147
+ end
148
+
149
+ module Merb
150
+ class Controller
151
+ cattr_reader :_cache
152
+ @@_cache = Merb::Cache.new
153
+ # extends Merb::Controller with new instance methods
154
+ include Merb::Cache::ControllerInstanceMethods
155
+ class << self
156
+ # extends Merb::Controller with new class methods
157
+ include Merb::Cache::ControllerClassMethods
158
+ end
159
+ end
160
+ end
161
+
162
+ Merb::BootLoader.after_app_loads do
163
+ # the cache starts after the application is loaded
164
+ Merb::Controller._cache.start
165
+ end
@@ -0,0 +1,6 @@
1
+ namespace :merb_cache do
2
+ desc "Do something for merb-cache"
3
+ task :default do
4
+ puts "merb-cache doesn't do anything"
5
+ end
6
+ end
@@ -0,0 +1,14 @@
1
+ ---
2
+ :development: &defaults
3
+ :adapter: sqlite3
4
+ :database: tmp/merb-cache.sqlite3
5
+ :log_stream: log/sql.log
6
+ :log_level: 0
7
+
8
+ :test:
9
+ <<: *defaults
10
+ :database: tmp/merb-cache.sqlite3
11
+
12
+ :production:
13
+ <<: *defaults
14
+ :database: tmp/merb-cache.sqlite3
@@ -0,0 +1,87 @@
1
+ class CacheController < Merb::Controller
2
+ self._template_root = File.dirname(__FILE__) / "views"
3
+
4
+ cache_action :action3
5
+ cache_action :action4, 0.05
6
+ # or cache_actions :action3, [:action4, 0.05]
7
+
8
+ cache_page :action5
9
+ cache_page :action6, 0.05
10
+ # or cache_pages :action5, [:action6, 0.05]
11
+ cache_page :action7
12
+
13
+ cache_action :action8, 0.05, :if => proc {|controller| !controller.params[:id].empty?}
14
+ cache_action :action9, 0.05, :unless => proc {|controller| controller.params[:id].empty?}
15
+ cache_action :action10, :if => :non_empty_id?
16
+ cache_action :action11, :unless => :empty_id?
17
+
18
+ def action1
19
+ render
20
+ end
21
+
22
+ def action2
23
+ render
24
+ end
25
+
26
+ def action3
27
+ "test action3"
28
+ end
29
+
30
+ def action4
31
+ "test action4"
32
+ end
33
+
34
+ def action5
35
+ "test action5"
36
+ end
37
+
38
+ def action6
39
+ Time.now.to_s
40
+ end
41
+
42
+ def action7
43
+ provides :js, :css, :html, :xml, :jpg
44
+ case params[:format]
45
+ when "css"
46
+ "CSS"
47
+ when "js"
48
+ "JS"
49
+ when "html"
50
+ "HTML"
51
+ when "xml"
52
+ "XML"
53
+ when "jpg"
54
+ "JPG"
55
+ else
56
+ raise "BAD FORMAT: #{params[:format].inspect}"
57
+ end
58
+ end
59
+
60
+ def action8
61
+ "test action8"
62
+ end
63
+
64
+ def action9
65
+ "test action9"
66
+ end
67
+
68
+ def action10
69
+ "test action10"
70
+ end
71
+
72
+ def action11
73
+ "test action11"
74
+ end
75
+
76
+ def empty_id?
77
+ params[:id].empty?
78
+ end
79
+
80
+ def non_empty_id?
81
+ !empty_id?
82
+ end
83
+
84
+ def index
85
+ "test index"
86
+ end
87
+ end
@@ -0,0 +1,433 @@
1
+ Mon, 21 Jul 2008 23:29:20 GMT ~ info ~ Logfile created
2
+ ~ Using memcache cache
3
+ ~ Not Using Sessions
4
+ ~ Using memory cache
5
+ ~ Not Using Sessions
6
+ ~ cache: expired all
7
+ ~ {:after_filters_time=>2.0e-05, :before_filters_time=>4.0e-05, :action_time=>0.000221}
8
+ ~ {:after_filters_time=>4.0e-05, :before_filters_time=>2.5e-05, :action_time=>0.000792}
9
+ ~ cache: hit (key1)
10
+ ~ {:after_filters_time=>2.2e-05, :before_filters_time=>2.5e-05, :action_time=>0.000636}
11
+ ~ cache: hit (key11)
12
+ ~ {:after_filters_time=>4.5e-05, :before_filters_time=>9.4e-05, :action_time=>0.001524}
13
+ ~ cache: hit (key11)
14
+ ~ cache: expired (key11)
15
+ ~ cache: miss (key11)
16
+ ~ {:after_filters_time=>3.8e-05, :before_filters_time=>8.8e-05, :action_time=>0.001444}
17
+ ~ cache: expired (key1)
18
+ ~ cache: miss (key1)
19
+ ~ {:after_filters_time=>3.1e-05, :before_filters_time=>4.0e-05, :action_time=>0.00092}
20
+ ~ cache: miss (unknown_key)
21
+ ~ cache: set (test1)
22
+ ~ cache: hit (test1)
23
+ ~ cache: set (test2)
24
+ ~ cache: hit (test2)
25
+ ~ cache: set (test3)
26
+ ~ cache: hit (test3)
27
+ ~ cache: expired matching (test)
28
+ ~ cache: miss (test1)
29
+ ~ cache: miss (test2)
30
+ ~ cache: miss (test3)
31
+ ~ cache: set (timed_key)
32
+ ~ cache: hit (timed_key)
33
+ ~ cache: miss (timed_key)
34
+ ~ cache: set (test1)
35
+ ~ cache: expired (test1)
36
+ ~ cache: miss (test1)
37
+ ~ cache: set (test2/id1)
38
+ ~ cache: expired (test2/id1)
39
+ ~ cache: miss (test2/id1)
40
+ ~ cache: set (test3)
41
+ ~ cache: expired (test3)
42
+ ~ cache: miss (test3)
43
+ ~ cache: set (test4/id1)
44
+ ~ cache: expired matching (test4/id1)
45
+ ~ cache: miss (test4/id1/id2)
46
+ ~ cache: expired all
47
+ ~ cache: miss (key1)
48
+ ~ cache: set (key1)
49
+ ~ cache: hit (key1)
50
+ ~ cache: miss (/cache_controller/action3)
51
+ ~ cache: set (/cache_controller/action3)
52
+ ~ {:after_filters_time=>7.9e-05, :before_filters_time=>0.000111, :action_time=>0.000218}
53
+ ~ cache: hit (/cache_controller/action3)
54
+ ~ cache: expired (/cache_controller/action3)
55
+ ~ cache: miss (/cache_controller/action3)
56
+ ~ cache: miss (/cache_controller/action3/abc/456/ghi)
57
+ ~ cache: set (/cache_controller/action3/abc/456/ghi)
58
+ ~ {:after_filters_time=>6.9e-05, :before_filters_time=>7.9e-05, :action_time=>0.000163}
59
+ ~ cache: hit (/cache_controller/action3/abc/456/ghi)
60
+ ~ cache: hit (/cache_controller/action3/abc/456/ghi)
61
+ ~ {:after_filters_time=>3.4e-05, :action_time=>0.00011}
62
+ ~ cache: expired (/cache_controller/action3/abc/456/ghi)
63
+ ~ cache: miss (/cache_controller/action3/abc/456/ghi)
64
+ ~ cache: miss (/cache_controller/action4)
65
+ ~ cache: set (/cache_controller/action4)
66
+ ~ {:after_filters_time=>7.6e-05, :before_filters_time=>7.9e-05, :action_time=>0.00017}
67
+ ~ cache: hit (/cache_controller/action4)
68
+ ~ cache: miss (/cache_controller/action4)
69
+ ~ cache: expired matching (/cache_controller/action4)
70
+ ~ cache: miss (/cache_controller/action4/path/to/nowhere)
71
+ ~ cache: set (/cache_controller/action4/path/to/nowhere)
72
+ ~ {:after_filters_time=>9.5e-05, :before_filters_time=>0.000108, :action_time=>0.000227}
73
+ ~ cache: miss (/cache_controller/action4/path/to/nowhere)
74
+ ~ cache: miss (/cache_controller/action4)
75
+ ~ cache: set (/cache_controller/action4)
76
+ ~ {:after_filters_time=>9.2e-05, :before_filters_time=>0.000112, :action_time=>0.000225}
77
+ ~ cache: expired (/cache_controller/action4)
78
+ ~ cache: miss (/cache_controller/action4)
79
+ ~ cache: set (/cache_controller/action4)
80
+ ~ {:after_filters_time=>8.1e-05, :before_filters_time=>8.8e-05, :action_time=>0.000184}
81
+ ~ cache: expired matching (/cache_control)
82
+ ~ cache: miss (/cache_controller/action4)
83
+ ~ cache: set (/cache_controller/action4)
84
+ ~ {:after_filters_time=>7.2e-05, :before_filters_time=>7.8e-05, :action_time=>0.000164}
85
+ ~ cache: expired (/cache_controller/action4)
86
+ ~ cache: miss (/cache_controller/action4/id1/id2)
87
+ ~ cache: set (/cache_controller/action4/id1/id2)
88
+ ~ {:after_filters_time=>7.3e-05, :before_filters_time=>7.8e-05, :action_time=>0.000164}
89
+ ~ cache: expired (/cache_controller/action4/id1/id2)
90
+ ~ cache: miss (/cache_controller/action4/id1/id2)
91
+ ~ cache: set (/cache_controller/action4/id1/id2)
92
+ ~ {:after_filters_time=>7.2e-05, :before_filters_time=>7.8e-05, :action_time=>0.000164}
93
+ ~ cache: expired matching (/cache_controller/action4)
94
+ ~ cache: miss (/cache_controller/action4)
95
+ ~ cache: set (/cache_controller/action4)
96
+ ~ {:after_filters_time=>7.3e-05, :before_filters_time=>7.7e-05, :action_time=>0.000164}
97
+ ~ cache: expired (/cache_controller/action4)
98
+ ~ cache: miss (/cache_controller/action4/id1/id2)
99
+ ~ cache: set (/cache_controller/action4/id1/id2)
100
+ ~ {:after_filters_time=>7.2e-05, :before_filters_time=>7.7e-05, :action_time=>0.000163}
101
+ ~ cache: expired matching (/cache_controller/action4/id1)
102
+ ~ cache: miss (/cache_controller/action4/id1/id2)
103
+ ~ cache: set (/cache_controller/action4/id1/id2)
104
+ ~ {:after_filters_time=>7.3e-05, :before_filters_time=>9.1e-05, :action_time=>0.000178}
105
+ ~ cache: expired matching (/cache_controller/action4)
106
+ ~ cache: miss (/cache_controller/action4/id1/id2)
107
+ ~ cache: set (/cache_controller/action4/id1/id2)
108
+ ~ {:after_filters_time=>7.1e-05, :before_filters_time=>7.7e-05, :action_time=>0.000164}
109
+ ~ cache: expired matching (/cache_controller/action4/id1)
110
+ ~ cache: miss (/cache_controller/action4/id1/id2)
111
+ ~ cache: set (/cache_controller/action4/id1/id2)
112
+ ~ {:after_filters_time=>7.3e-05, :before_filters_time=>9.1e-05, :action_time=>0.000178}
113
+ ~ cache: expired (/cache_controller/action4/id1/id2)
114
+ ~ cache: miss (/cache_controller/action4)
115
+ ~ cache: set (/cache_controller/action4)
116
+ ~ {:after_filters_time=>7.2e-05, :before_filters_time=>9.1e-05, :action_time=>0.000177}
117
+ ~ cache: expired (/cache_controller/action4)
118
+ ~ cache: miss (/cache_controller/action4/id1/id2)
119
+ ~ cache: set (/cache_controller/action4/id1/id2)
120
+ ~ {:after_filters_time=>6.5e-05, :before_filters_time=>8.3e-05, :action_time=>0.000161}
121
+ ~ cache: expired (/cache_controller/action4/id1/id2)
122
+ ~ cache: miss (/cache_controller/action4/id1/id2)
123
+ ~ cache: set (/cache_controller/action4/id1/id2)
124
+ ~ {:after_filters_time=>6.5e-05, :before_filters_time=>8.2e-05, :action_time=>0.00016}
125
+ ~ cache: expired matching (/cache_controller/action4/id1)
126
+ ~ cache: miss (/cache_controller/action4/id1/id2)
127
+ ~ cache: set (/cache_controller/action4/id1/id2)
128
+ ~ {:after_filters_time=>5.0e-05, :before_filters_time=>5.8e-05, :action_time=>0.000119}
129
+ ~ cache: expired matching (/cache_controller/action4/id1)
130
+ ~ {:after_filters_time=>2.6e-05, :before_filters_time=>0.000175, :action_time=>0.000213}
131
+ ~ cache: miss (/cache_controller/action8/cache)
132
+ ~ cache: set (/cache_controller/action8/cache)
133
+ ~ {:after_filters_time=>5.5e-05, :before_filters_time=>0.000142, :action_time=>0.000208}
134
+ ~ {:after_filters_time=>2.6e-05, :before_filters_time=>0.000104, :action_time=>0.000141}
135
+ ~ cache: miss (/cache_controller/action9/cache)
136
+ ~ cache: set (/cache_controller/action9/cache)
137
+ ~ {:after_filters_time=>5.6e-05, :before_filters_time=>0.000129, :action_time=>0.000194}
138
+ ~ {:after_filters_time=>2.4e-05, :before_filters_time=>0.000106, :action_time=>0.000139}
139
+ ~ cache: miss (/cache_controller/action10/cache)
140
+ ~ cache: set (/cache_controller/action10/cache)
141
+ ~ {:after_filters_time=>5.2e-05, :before_filters_time=>0.000126, :action_time=>0.000187}
142
+ ~ {:after_filters_time=>2.4e-05, :before_filters_time=>0.000103, :action_time=>0.000136}
143
+ ~ cache: miss (/cache_controller/action11/cache)
144
+ ~ cache: set (/cache_controller/action11/cache)
145
+ ~ {:after_filters_time=>5.1e-05, :before_filters_time=>0.000134, :action_time=>0.000195}
146
+ ~ cache: set (/cache_controller/action5)
147
+ ~ {:after_filters_time=>0.000414, :before_filters_time=>0.000163, :action_time=>0.000596}
148
+ ~ cache: set (/cache_controller/action5/this/is/a/test)
149
+ ~ {:after_filters_time=>0.001305, :before_filters_time=>0.000296, :action_time=>0.001627}
150
+ ~ cache: set (/cache_controller/action6)
151
+ ~ {:after_filters_time=>0.000582, :before_filters_time=>0.000236, :action_time=>0.000858}
152
+ ~ cache: hit (/cache_controller/action6)
153
+ ~ {:after_filters_time=>2.4e-05, :action_time=>0.000346}
154
+ ~ cache: set (/cache_controller/action6)
155
+ ~ {:after_filters_time=>0.000622, :before_filters_time=>0.0008, :action_time=>0.001475}
156
+ ~ cache: set (/cache_controller/action6/path/to/nowhere)
157
+ ~ {:after_filters_time=>0.001422, :before_filters_time=>0.000258, :action_time=>0.001737}
158
+ ~ cache: hit (/cache_controller/action6/path/to/nowhere)
159
+ ~ {:after_filters_time=>3.8e-05, :action_time=>0.000656}
160
+ ~ cache: set (/cache_controller/action6/path/to/nowhere)
161
+ ~ {:after_filters_time=>0.000387, :before_filters_time=>0.000445, :action_time=>0.000869}
162
+ ~ cache: set (/cache_controller/action6)
163
+ ~ {:after_filters_time=>0.000341, :before_filters_time=>0.000178, :action_time=>0.000543}
164
+ ~ cache: set (/cache_controller/action6)
165
+ ~ {:after_filters_time=>0.000574, :before_filters_time=>0.000164, :action_time=>0.000771}
166
+ ~ cache: set (/cache_controller/action6)
167
+ ~ {:after_filters_time=>0.000375, :before_filters_time=>0.000167, :action_time=>0.000575}
168
+ ~ cache: set (/cache_controller/action6/id1/id2)
169
+ ~ {:after_filters_time=>0.00086, :before_filters_time=>0.000183, :action_time=>0.001069}
170
+ ~ cache: set (/cache_controller/action6/id1/id2)
171
+ ~ {:after_filters_time=>0.000349, :before_filters_time=>0.00016, :action_time=>0.000536}
172
+ ~ cache: set (/cache_controller/action6)
173
+ ~ {:after_filters_time=>0.000367, :before_filters_time=>0.000149, :action_time=>0.000543}
174
+ ~ cache: set (/cache_controller/action6/id1/id2)
175
+ ~ {:after_filters_time=>0.000718, :before_filters_time=>0.000163, :action_time=>0.000908}
176
+ ~ cache: set (/cache_controller/action6/id1/id2)
177
+ ~ {:after_filters_time=>0.000332, :before_filters_time=>0.000141, :action_time=>0.000502}
178
+ ~ cache: set (/cache_controller/action6/id1/id2)
179
+ ~ {:after_filters_time=>0.000696, :before_filters_time=>0.000155, :action_time=>0.000877}
180
+ ~ cache: set (/cache_controller/action6/id1/id2)
181
+ ~ {:after_filters_time=>0.000397, :before_filters_time=>0.000154, :action_time=>0.000578}
182
+ ~ cache: set (/cache_controller/action6)
183
+ ~ {:after_filters_time=>0.000371, :before_filters_time=>0.00018, :action_time=>0.000577}
184
+ ~ cache: set (/cache_controller/action6/id1/id2)
185
+ ~ {:after_filters_time=>0.000358, :before_filters_time=>0.000172, :action_time=>0.000555}
186
+ ~ cache: set (/cache_controller/action6/id1/id2)
187
+ ~ {:after_filters_time=>0.000353, :before_filters_time=>0.000156, :action_time=>0.000544}
188
+ ~ cache: set (/cache_controller/action6/id1/id2)
189
+ ~ {:after_filters_time=>0.000337, :before_filters_time=>0.000151, :action_time=>0.000515}
190
+ ~ cache: set (/cache_controller/action7.css)
191
+ ~ {:after_filters_time=>0.000535, :before_filters_time=>0.000459, :action_time=>0.001035}
192
+ ~ cache: hit (/cache_controller/action7.css)
193
+ ~ {:after_filters_time=>2.7e-05, :action_time=>0.000552}
194
+ ~ cache: set (/cache_controller/action7.js)
195
+ ~ {:after_filters_time=>0.000539, :before_filters_time=>0.000381, :action_time=>0.000956}
196
+ ~ cache: hit (/cache_controller/action7.js)
197
+ ~ {:after_filters_time=>2.2e-05, :action_time=>0.0003}
198
+ ~ cache: set (/cache_controller/action7.xml)
199
+ ~ {:after_filters_time=>0.000405, :before_filters_time=>0.000169, :action_time=>0.000599}
200
+ ~ cache: hit (/cache_controller/action7.xml)
201
+ ~ {:after_filters_time=>2.1e-05, :action_time=>0.000263}
202
+ ~ cache: set (/cache_controller/action7.jpg)
203
+ ~ {:after_filters_time=>0.000331, :before_filters_time=>0.000173, :action_time=>0.000528}
204
+ ~ cache: hit (/cache_controller/action7.jpg)
205
+ ~ {:after_filters_time=>1.9e-05, :action_time=>0.000259}
206
+ ~ cache: set (/cache_controller/action7.html)
207
+ ~ {:after_filters_time=>0.000308, :before_filters_time=>0.00017, :action_time=>0.0005}
208
+ ~ cache: hit (/cache_controller/action7.html)
209
+ ~ {:after_filters_time=>2.2e-05, :action_time=>0.000288}
210
+ ~ Using memcache cache
211
+ ~ Not Using Sessions
212
+ ~ cache: expired all
213
+ ~ {:after_filters_time=>1.9e-05, :before_filters_time=>4.1e-05, :action_time=>0.000244}
214
+ ~ cache: miss (key1)
215
+ ~ cache: set (key1)
216
+ ~ {:after_filters_time=>2.8e-05, :before_filters_time=>2.4e-05, :action_time=>0.00422}
217
+ ~ cache: miss (key11)
218
+ ~ cache: set (key11)
219
+ ~ {:after_filters_time=>2.4e-05, :before_filters_time=>3.4e-05, :action_time=>0.001341}
220
+ ~ {:after_filters_time=>2.7e-05, :before_filters_time=>4.9e-05, :action_time=>0.001105}
221
+ ~ cache: expired (key11)
222
+ ~ cache: miss (key11)
223
+ ~ {:after_filters_time=>3.9e-05, :before_filters_time=>9.3e-05, :action_time=>0.001921}
224
+ ~ cache: expired (key1)
225
+ ~ cache: miss (key1)
226
+ ~ cache: miss (key1)
227
+ ~ cache: set (key1)
228
+ ~ {:after_filters_time=>3.1e-05, :before_filters_time=>4.2e-05, :action_time=>0.001765}
229
+ ~ cache: miss (unknown_key)
230
+ ~ cache: set (test1)
231
+ ~ cache: set (test2)
232
+ ~ cache: set (test3)
233
+ ~ cache: expired (test1)
234
+ ~ cache: expired (test2)
235
+ ~ cache: expired (test3)
236
+ ~ cache: miss (test1)
237
+ ~ cache: miss (test2)
238
+ ~ cache: miss (test3)
239
+ ~ cache: set (timed_key)
240
+ ~ cache: miss (timed_key)
241
+ ~ cache: set (test1)
242
+ ~ cache: expired (test1)
243
+ ~ cache: miss (test1)
244
+ ~ cache: set (test2/id1)
245
+ ~ cache: expired (test2/id1)
246
+ ~ cache: miss (test2/id1)
247
+ ~ cache: set (test3)
248
+ ~ cache: expired (test3)
249
+ ~ cache: miss (test3)
250
+ ~ cache: set (test4/id1)
251
+ ~ cache: expired (test4/id1)
252
+ ~ cache: miss (test4/id1/id2)
253
+ ~ cache: expired all
254
+ ~ cache: miss (key1)
255
+ ~ cache: set (key1)
256
+ ~ cache: miss (/cache_controller/action3)
257
+ ~ cache: set (/cache_controller/action3)
258
+ ~ {:after_filters_time=>0.000491, :before_filters_time=>0.000238, :action_time=>0.000753}
259
+ ~ cache: expired (/cache_controller/action3)
260
+ ~ cache: miss (/cache_controller/action3)
261
+ ~ cache: miss (/cache_controller/action3/abc/456/ghi)
262
+ ~ cache: set (/cache_controller/action3/abc/456/ghi)
263
+ ~ {:after_filters_time=>0.000458, :before_filters_time=>0.000186, :action_time=>0.000689}
264
+ ~ {:after_filters_time=>2.3e-05, :action_time=>0.000186}
265
+ ~ cache: expired (/cache_controller/action3/abc/456/ghi)
266
+ ~ cache: miss (/cache_controller/action3/abc/456/ghi)
267
+ ~ cache: miss (/cache_controller/action4)
268
+ ~ cache: set (/cache_controller/action4)
269
+ ~ {:after_filters_time=>0.000462, :before_filters_time=>0.000182, :action_time=>0.000656}
270
+ ~ cache: miss (/cache_controller/action4)
271
+ ~ cache: miss (/cache_controller/action4)
272
+ ~ cache: expired (/cache_controller/action4)
273
+ ~ cache: miss (/cache_controller/action4/path/to/nowhere)
274
+ ~ cache: miss (/cache_controller/action4/path/to/nowhere)
275
+ ~ cache: set (/cache_controller/action4/path/to/nowhere)
276
+ ~ {:after_filters_time=>0.000713, :before_filters_time=>0.000315, :action_time=>0.00105}
277
+ ~ cache: miss (/cache_controller/action4/path/to/nowhere)
278
+ ~ cache: miss (/cache_controller/action4/path/to/nowhere)
279
+ ~ cache: miss (/cache_controller/action4)
280
+ ~ cache: set (/cache_controller/action4)
281
+ ~ {:after_filters_time=>0.002476, :before_filters_time=>0.000364, :action_time=>0.002862}
282
+ ~ cache: expired (/cache_controller/action4)
283
+ ~ cache: miss (/cache_controller/action4)
284
+ ~ cache: miss (/cache_controller/action4)
285
+ ~ cache: set (/cache_controller/action4)
286
+ ~ {:after_filters_time=>0.000716, :before_filters_time=>0.000307, :action_time=>0.00104}
287
+ ~ cache: expired (/cache_controller/action4/path/to/nowhere)
288
+ ~ cache: expired (/cache_controller/action4)
289
+ ~ cache: miss (/cache_controller/action4)
290
+ ~ cache: miss (/cache_controller/action4)
291
+ ~ cache: set (/cache_controller/action4)
292
+ ~ {:after_filters_time=>0.000476, :before_filters_time=>0.000189, :action_time=>0.000675}
293
+ ~ cache: expired (/cache_controller/action4)
294
+ ~ cache: miss (/cache_controller/action4)
295
+ ~ cache: miss (/cache_controller/action4/id1/id2)
296
+ ~ cache: set (/cache_controller/action4/id1/id2)
297
+ ~ {:after_filters_time=>0.000473, :before_filters_time=>0.000189, :action_time=>0.000671}
298
+ ~ cache: expired (/cache_controller/action4/id1/id2)
299
+ ~ cache: miss (/cache_controller/action4/id1/id2)
300
+ ~ cache: miss (/cache_controller/action4/id1/id2)
301
+ ~ cache: set (/cache_controller/action4/id1/id2)
302
+ ~ {:after_filters_time=>0.000486, :before_filters_time=>0.000181, :action_time=>0.000678}
303
+ ~ cache: expired (/cache_controller/action4/id1/id2)
304
+ ~ cache: miss (/cache_controller/action4/id1/id2)
305
+ ~ cache: miss (/cache_controller/action4)
306
+ ~ cache: set (/cache_controller/action4)
307
+ ~ {:after_filters_time=>0.000484, :before_filters_time=>0.00019, :action_time=>0.000683}
308
+ ~ cache: expired (/cache_controller/action4)
309
+ ~ cache: miss (/cache_controller/action4)
310
+ ~ cache: miss (/cache_controller/action4/id1/id2)
311
+ ~ cache: set (/cache_controller/action4/id1/id2)
312
+ ~ {:after_filters_time=>0.000487, :before_filters_time=>0.000182, :action_time=>0.000679}
313
+ ~ cache: expired (/cache_controller/action4/id1/id2)
314
+ ~ cache: miss (/cache_controller/action4/id1/id2)
315
+ ~ cache: miss (/cache_controller/action4/id1/id2)
316
+ ~ cache: set (/cache_controller/action4/id1/id2)
317
+ ~ {:after_filters_time=>0.000471, :before_filters_time=>0.000187, :action_time=>0.000668}
318
+ ~ cache: expired (/cache_controller/action4/id1/id2)
319
+ ~ cache: miss (/cache_controller/action4/id1/id2)
320
+ ~ cache: miss (/cache_controller/action4/id1/id2)
321
+ ~ cache: set (/cache_controller/action4/id1/id2)
322
+ ~ {:after_filters_time=>0.000475, :before_filters_time=>0.000195, :action_time=>0.00068}
323
+ ~ cache: expired (/cache_controller/action4/id1/id2)
324
+ ~ cache: miss (/cache_controller/action4/id1/id2)
325
+ ~ cache: miss (/cache_controller/action4/id1/id2)
326
+ ~ cache: set (/cache_controller/action4/id1/id2)
327
+ ~ {:after_filters_time=>0.000489, :before_filters_time=>0.000174, :action_time=>0.000671}
328
+ ~ cache: expired (/cache_controller/action4/id1/id2)
329
+ ~ cache: miss (/cache_controller/action4/id1/id2)
330
+ ~ cache: miss (/cache_controller/action4)
331
+ ~ cache: set (/cache_controller/action4)
332
+ ~ {:after_filters_time=>0.000485, :before_filters_time=>0.000199, :action_time=>0.000694}
333
+ ~ cache: expired (/cache_controller/action4)
334
+ ~ cache: miss (/cache_controller/action4)
335
+ ~ cache: miss (/cache_controller/action4/id1/id2)
336
+ ~ cache: set (/cache_controller/action4/id1/id2)
337
+ ~ {:after_filters_time=>0.000474, :before_filters_time=>0.000189, :action_time=>0.000673}
338
+ ~ cache: expired (/cache_controller/action4/id1/id2)
339
+ ~ cache: miss (/cache_controller/action4/id1/id2)
340
+ ~ cache: miss (/cache_controller/action4/id1/id2)
341
+ ~ cache: set (/cache_controller/action4/id1/id2)
342
+ ~ {:after_filters_time=>0.000471, :before_filters_time=>0.000186, :action_time=>0.000667}
343
+ ~ cache: expired (/cache_controller/action4/id1/id2)
344
+ ~ cache: miss (/cache_controller/action4/id1/id2)
345
+ ~ cache: miss (/cache_controller/action4/id1/id2)
346
+ ~ cache: set (/cache_controller/action4/id1/id2)
347
+ ~ {:after_filters_time=>0.000486, :before_filters_time=>0.00019, :action_time=>0.000686}
348
+ ~ cache: expired (/cache_controller/action4/id1/id2)
349
+ ~ cache: miss (/cache_controller/action4/id1/id2)
350
+ ~ {:after_filters_time=>2.6e-05, :before_filters_time=>0.000162, :action_time=>0.000202}
351
+ ~ cache: miss (/cache_controller/action8)
352
+ ~ cache: miss (/cache_controller/action8/cache)
353
+ ~ cache: set (/cache_controller/action8/cache)
354
+ ~ {:after_filters_time=>0.000484, :before_filters_time=>0.000266, :action_time=>0.000759}
355
+ ~ {:after_filters_time=>2.6e-05, :before_filters_time=>0.000107, :action_time=>0.000143}
356
+ ~ cache: miss (/cache_controller/action9)
357
+ ~ cache: miss (/cache_controller/action9/cache)
358
+ ~ cache: set (/cache_controller/action9/cache)
359
+ ~ {:after_filters_time=>0.000502, :before_filters_time=>0.000276, :action_time=>0.000788}
360
+ ~ {:after_filters_time=>2.5e-05, :before_filters_time=>0.000147, :action_time=>0.000182}
361
+ ~ cache: miss (/cache_controller/action10)
362
+ ~ cache: miss (/cache_controller/action10/cache)
363
+ ~ cache: set (/cache_controller/action10/cache)
364
+ ~ {:after_filters_time=>0.003832, :before_filters_time=>0.000274, :action_time=>0.004122}
365
+ ~ {:after_filters_time=>3.2e-05, :before_filters_time=>0.000154, :action_time=>0.000203}
366
+ ~ cache: miss (/cache_controller/action11)
367
+ ~ cache: miss (/cache_controller/action11/cache)
368
+ ~ cache: set (/cache_controller/action11/cache)
369
+ ~ {:after_filters_time=>0.000503, :before_filters_time=>0.000397, :action_time=>0.000915}
370
+ ~ cache: set (/cache_controller/action5)
371
+ ~ {:after_filters_time=>0.000436, :before_filters_time=>0.000189, :action_time=>0.000647}
372
+ ~ cache: set (/cache_controller/action5/this/is/a/test)
373
+ ~ {:after_filters_time=>0.001277, :before_filters_time=>0.000256, :action_time=>0.001557}
374
+ ~ cache: set (/cache_controller/action6)
375
+ ~ {:after_filters_time=>0.000479, :before_filters_time=>0.000253, :action_time=>0.00077}
376
+ ~ cache: hit (/cache_controller/action6)
377
+ ~ {:after_filters_time=>3.8e-05, :action_time=>0.000645}
378
+ ~ cache: set (/cache_controller/action6)
379
+ ~ {:after_filters_time=>0.00062, :before_filters_time=>0.000919, :action_time=>0.001593}
380
+ ~ cache: set (/cache_controller/action6/path/to/nowhere)
381
+ ~ {:after_filters_time=>0.001441, :before_filters_time=>0.000285, :action_time=>0.001775}
382
+ ~ cache: hit (/cache_controller/action6/path/to/nowhere)
383
+ ~ {:after_filters_time=>3.8e-05, :action_time=>0.000643}
384
+ ~ cache: set (/cache_controller/action6/path/to/nowhere)
385
+ ~ {:after_filters_time=>0.000637, :before_filters_time=>0.000806, :action_time=>0.001497}
386
+ ~ cache: set (/cache_controller/action6)
387
+ ~ {:after_filters_time=>0.000548, :before_filters_time=>0.000235, :action_time=>0.000817}
388
+ ~ cache: set (/cache_controller/action6)
389
+ ~ {:after_filters_time=>0.00057, :before_filters_time=>0.000325, :action_time=>0.000951}
390
+ ~ cache: set (/cache_controller/action6)
391
+ ~ {:after_filters_time=>0.00043, :before_filters_time=>0.000217, :action_time=>0.000679}
392
+ ~ cache: set (/cache_controller/action6/id1/id2)
393
+ ~ {:after_filters_time=>0.001216, :before_filters_time=>0.000286, :action_time=>0.00153}
394
+ ~ cache: set (/cache_controller/action6/id1/id2)
395
+ ~ {:after_filters_time=>0.000472, :before_filters_time=>0.000228, :action_time=>0.000734}
396
+ ~ cache: set (/cache_controller/action6)
397
+ ~ {:after_filters_time=>0.000451, :before_filters_time=>0.000232, :action_time=>0.000713}
398
+ ~ cache: set (/cache_controller/action6/id1/id2)
399
+ ~ {:after_filters_time=>0.000982, :before_filters_time=>0.000246, :action_time=>0.001256}
400
+ ~ cache: set (/cache_controller/action6/id1/id2)
401
+ ~ {:after_filters_time=>0.000375, :before_filters_time=>0.000203, :action_time=>0.000604}
402
+ ~ cache: set (/cache_controller/action6/id1/id2)
403
+ ~ {:after_filters_time=>0.000868, :before_filters_time=>0.000203, :action_time=>0.001096}
404
+ ~ cache: set (/cache_controller/action6/id1/id2)
405
+ ~ {:after_filters_time=>0.000316, :before_filters_time=>0.000188, :action_time=>0.000527}
406
+ ~ cache: set (/cache_controller/action6)
407
+ ~ {:after_filters_time=>0.000301, :before_filters_time=>0.000264, :action_time=>0.000584}
408
+ ~ cache: set (/cache_controller/action6/id1/id2)
409
+ ~ {:after_filters_time=>0.000284, :before_filters_time=>0.000184, :action_time=>0.000487}
410
+ ~ cache: set (/cache_controller/action6/id1/id2)
411
+ ~ {:after_filters_time=>0.000294, :before_filters_time=>0.00013, :action_time=>0.000444}
412
+ ~ cache: set (/cache_controller/action6/id1/id2)
413
+ ~ {:after_filters_time=>0.000653, :before_filters_time=>0.000335, :action_time=>0.001034}
414
+ ~ cache: set (/cache_controller/action7.css)
415
+ ~ {:after_filters_time=>0.000679, :before_filters_time=>0.000226, :action_time=>0.000941}
416
+ ~ cache: hit (/cache_controller/action7.css)
417
+ ~ {:after_filters_time=>2.5e-05, :action_time=>0.000364}
418
+ ~ cache: set (/cache_controller/action7.js)
419
+ ~ {:after_filters_time=>0.000474, :before_filters_time=>0.000188, :action_time=>0.000696}
420
+ ~ cache: hit (/cache_controller/action7.js)
421
+ ~ {:after_filters_time=>2.0e-05, :action_time=>0.000274}
422
+ ~ cache: set (/cache_controller/action7.xml)
423
+ ~ {:after_filters_time=>0.000548, :before_filters_time=>0.000168, :action_time=>0.000902}
424
+ ~ cache: hit (/cache_controller/action7.xml)
425
+ ~ {:after_filters_time=>2.1e-05, :action_time=>0.000298}
426
+ ~ cache: set (/cache_controller/action7.jpg)
427
+ ~ {:after_filters_time=>0.000318, :before_filters_time=>0.000162, :action_time=>0.000504}
428
+ ~ cache: hit (/cache_controller/action7.jpg)
429
+ ~ {:after_filters_time=>1.9e-05, :action_time=>0.000241}
430
+ ~ cache: set (/cache_controller/action7.html)
431
+ ~ {:after_filters_time=>0.000294, :before_filters_time=>0.000153, :action_time=>0.000467}
432
+ ~ cache: hit (/cache_controller/action7.html)
433
+ ~ {:after_filters_time=>2.0e-05, :action_time=>0.000239}