Module: Radiant::Cache

Defined in:
lib/radiant/cache.rb

Class Method Summary collapse

Class Method Details

.clearObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/radiant/cache.rb', line 16

def self.clear
  [metastores.values + entitystores.values].flatten.each do |store|
    case store
    when Rack::Cache::EntityStore::Disk, Rack::Cache::MetaStore::Disk
      Dir[File.join(store.root, '*')].each do |file|
        FileUtils.rm_rf(file)
      end
    end
  end
end

.entitystoresObject



31
32
33
# File 'lib/radiant/cache.rb', line 31

def self.entitystores
  Rack::Cache::Storage.instance.instance_variable_get('@entitystores')
end

.metastoresObject



27
28
29
# File 'lib/radiant/cache.rb', line 27

def self.metastores
  Rack::Cache::Storage.instance.instance_variable_get('@metastores')
end

.new(backend, options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/radiant/cache.rb', line 6

def self.new(backend, options = {})
  Rack::Cache.new(backend, {
    :entitystore => "file:tmp/cache/entity",
    :metastore => "file:tmp/cache/meta",
    :verbose => false,
    :allow_reload => false,
    :allow_revalidate => false
  }.merge(options))
end