Class Tilt::Cache
In: lib/sinatra/tilt.rb
Parent: Object

Extremely simple template cache implementation. Calling applications create a Tilt::Cache instance and use fetch with any set of hashable arguments (such as those to Tilt.new):

  cache = Tilt::Cache.new
  cache.fetch(path, line, options) { Tilt.new(path, line, options) }

Subsequent invocations return the already loaded template object.

Methods

clear   fetch   new  

Public Class methods

[Source]

     # File lib/sinatra/tilt.rb, line 323
323:     def initialize
324:       @cache = {}
325:     end

Public Instance methods

[Source]

     # File lib/sinatra/tilt.rb, line 331
331:     def clear
332:       @cache = {}
333:     end

[Source]

     # File lib/sinatra/tilt.rb, line 327
327:     def fetch(*key)
328:       @cache[key] ||= yield
329:     end

[Validate]