3 |
= Ruby/Cache Reference Manual |
= Ruby/Cache Reference Manual |
4 |
|
|
5 |
This is the reference manual for |
This is the reference manual for |
6 |
((<"Ruby/Cache"|URL:http://www.nongnu.org/pupa/ruby-cache.html>)) version 0.2. |
((<"Ruby/Cache"|URL:http://www.nongnu.org/pupa/ruby-cache.html>)) version 0.3. |
7 |
|
|
8 |
Ruby/Cache provides a class for caching arbitrary objects based on LRU |
Ruby/Cache provides a class for caching arbitrary objects based on LRU |
9 |
algorithm. The class (({Cache})) looks like a variant of (({Hash})), and, |
algorithm. The class (({Cache})) looks like a variant of (({Hash})), and, |
31 |
Return the version number. |
Return the version number. |
32 |
|
|
33 |
--- Cache.new([max_obj_size, max_size, max_num, expiration, &hook]) |
--- Cache.new([max_obj_size, max_size, max_num, expiration, &hook]) |
34 |
|
--- Cache.new(hash, &hook) |
35 |
Create a new Cache object. |
Create a new Cache object. |
36 |
|
|
37 |
((|max_obj_size|)) is the maximum size per object allowed to be cached. |
((|max_obj_size|)) is the maximum size per object allowed to be cached. |
47 |
|
|
48 |
((|hook|)) is called whenever an object is invalidated, in the form |
((|hook|)) is called whenever an object is invalidated, in the form |
49 |
(({hook(key, value)})). So you can use ((|hook|)) for cleanups. |
(({hook(key, value)})). So you can use ((|hook|)) for cleanups. |
50 |
|
|
51 |
|
If the latter form is used, ((|hash|)) must be a Hash object, and it |
52 |
|
represents keyword arguments. ((|hash|)) can have any combination of |
53 |
|
these keys: (({:max_obj_size})), (({:max_size})), (({:max_num})) and |
54 |
|
(({:expiration})). The meanings are the same as above. |
55 |
|
|
56 |
== Methods: |
== Methods: |
57 |
|
|