class Tilt::Cache
If this is too limiting for you, use a different cache implementation.
key#hash and key#eql? should not change.
being passed to #fetch. More specifically, the values returned by
* Keys are not copied defensively, and should not be modified after
* Size is unbounded.
* Not thread-safe.
limitations:
Tilt::Cache is a thin wrapper around Hash. It has the following
@note
Subsequent invocations return the already loaded template object.
cache.fetch(path, line, options) { Tilt.new(path, line, options) }
cache = Tilt::Cache.new
arguments (such as those to Tilt.new):
create a Tilt::Cache instance and use #fetch with any set of hashable
Extremely simple template cache implementation. Calling applications
def clear
def clear @cache = {} end
def fetch(*key)
- Yieldreturn: - the value to cache for key
Other tags:
- Yield: -
def fetch(*key) @cache.fetch(key) do @cache[key] = yield end end
def initialize
def initialize @cache = {} end