Class: Microengine::FileCache

Inherits:
Object
  • Object
show all
Defined in:
lib/file_cache.rb

Overview

Load cached pages directly from files. MemoryCache is more faster.

Direct Known Subclasses

MemoryCache

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#langsObject (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

#refreshObject

Refresh cache



26
27
28
29
# File 'lib/file_cache.rb', line 26

def refresh
  @langs = {}
  cache '/'
end