Class: Microengine::FileCache
- Inherits:
-
Object
- Object
- Microengine::FileCache
- Defined in:
- lib/file_cache.rb
Overview
Load cached pages directly from files. MemoryCache is more faster.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#langs ⇒ Object
readonly
Available languages.
Instance Method Summary collapse
-
#get(path, lang) ⇒ Object
Return XHTML page content.
-
#refresh ⇒ Object
Refresh cache.
Instance Attribute Details
#langs ⇒ Object (readonly)
Available languages
23 24 25 |
# File 'lib/file_cache.rb', line 23 def langs @langs end |
Instance Method Details
#get(path, lang) ⇒ Object
Return XHTML page content
32 33 34 35 |
# File 'lib/file_cache.rb', line 32 def get(path, lang) lang.sub!(/[^[:alpha:]_-]/, '') IO.read MICROENGINE_ROOT + '/cache/' + path + 'content.' + lang + '.html' end |
#refresh ⇒ Object
Refresh cache
26 27 28 29 |
# File 'lib/file_cache.rb', line 26 def refresh @langs = {} cache '/' end |