Module: Syro::Tilt::Cache
- Included in:
- Syro::Tilt
- Defined in:
- lib/syro/tilt/cache.rb
Overview
Add template and path caching to Syro::Tilt.
Defined Under Namespace
Classes: MemoryStore
Class Method Summary collapse
Instance Method Summary collapse
-
#template(path) ⇒ Object
Cache calls to Syro::Tilt#template.
-
#template_path(path, from, accept) ⇒ Object
Cache calls to Syro::Tilt#template_path.
Class Method Details
.template_cache ⇒ MemoryStore
28 29 30 |
# File 'lib/syro/tilt/cache.rb', line 28 def self.template_cache @template_cache end |
.template_path_cache ⇒ MemoryStore
33 34 35 |
# File 'lib/syro/tilt/cache.rb', line 33 def self.template_path_cache @template_path_cache end |
Instance Method Details
#template(path) ⇒ Object
Cache calls to Syro::Tilt#template.
38 39 40 41 42 |
# File 'lib/syro/tilt/cache.rb', line 38 def template(path) Cache.template_cache.fetch(path) do super(path) end end |
#template_path(path, from, accept) ⇒ Object
Cache calls to Syro::Tilt#template_path.
45 46 47 48 49 |
# File 'lib/syro/tilt/cache.rb', line 45 def template_path(path, from, accept) Cache.template_path_cache.fetch(path, from, accept) do super(path, from, accept) end end |