You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: padrino-cache/README.rdoc
+16-5Lines changed: 16 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,8 @@
5
5
This component enables caching of an application's response contents on
6
6
both page- and fragment-levels. Output cached in this manner is
7
7
persisted, until it expires or is actively expired, in a configurable store
8
-
of your choosing. Several common caching stores are supported out of the box.
8
+
of your choosing. Most popular key/value stores work out of the box. Take a look
9
+
at the [Moneta documentation](http://rubydoc.info/gems/moneta) for a list of all supported stores.
9
10
10
11
== Caching Quickstart
11
12
@@ -214,7 +215,8 @@ Note that any other action will reference the same content if it uses the same k
214
215
end
215
216
end
216
217
217
-
The <tt>opts</tt> argument is actually passed to the underlying store. All stores included with Padrino support the <tt>:expires</tt> option out of the box.
218
+
The <tt>opts</tt> argument is actually passed to the underlying store. The stores support the <tt>:expires</tt> option out of the box or
219
+
are enhanced by Moneta to support it.
218
220
219
221
Finally, to DRY up things a bit, we might do:
220
222
@@ -253,9 +255,15 @@ You can set a global caching option or a per app caching options.
253
255
254
256
=== Global Caching Options
255
257
256
-
Padrino.cache = Padrino::Cache.new(:LRUHash)
257
-
Padrino.cache = Padrino::Cache.new(:Memcached)
258
-
Padrino.cache = Padrino::Cache.new(:Redis)
258
+
Padrino.cache = Padrino::Cache.new(:LRUHash) # Keeps cached values in memory
259
+
Padrino.cache = Padrino::Cache.new(:Memcached) # Uses default server at localhost
You can manage your cache from anywhere in your app:
@@ -265,6 +273,9 @@ You can manage your cache from anywhere in your app:
265
273
Padrino.cache.delete('val')
266
274
Padrino.cache.clear
267
275
276
+
The Padrino cache constructor `Padrino::Cache.new` calls `Moneta.new` to create a cache instance. Please refer to the [Moneta documentation](http://rubydoc.info/gems/moneta) if you
277
+
have special requirements, for example if you want to configure the marshalling mechanism or use a more exotic backend.
0 commit comments