Class: Radiant::Cache::EntityStore

Inherits:
Rack::Cache::EntityStore::Disk
  • Object
show all
Defined in:
lib/radiant/cache.rb

Instance Method Summary collapse

Constructor Details

#initialize(root = "#{Rails.root}/tmp/cache/entity") ⇒ EntityStore

Returns a new instance of EntityStore.



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

def initialize(root="#{Rails.root}/tmp/cache/entity")
  super
  Radiant::Cache.entity_stores << self
end

Instance Method Details

#clearObject



37
38
39
# File 'lib/radiant/cache.rb', line 37

def clear
  Dir[File.join(self.root, "*")].each {|file| FileUtils.rm_rf(file) }
end

#write(body) ⇒ Object



41
42
43
44
45
# File 'lib/radiant/cache.rb', line 41

def write(body)
  # Verify that the cache directory exists before attempting to write
  FileUtils.mkdir_p(self.root, :mode => 0755) unless File.directory?(self.root)
  super
end