Class: Radiant::Cache::EntityStore
- Inherits:
-
Rack::Cache::EntityStore::Disk
- Object
- Rack::Cache::EntityStore::Disk
- Radiant::Cache::EntityStore
- Defined in:
- lib/radiant/cache.rb
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize(root = "#{Rails.root}/tmp/cache/entity") ⇒ EntityStore
constructor
A new instance of EntityStore.
- #write(body) ⇒ Object
Constructor Details
#initialize(root = "#{Rails.root}/tmp/cache/entity") ⇒ EntityStore
33 34 35 36 |
# File 'lib/radiant/cache.rb', line 33 def initialize(root="#{Rails.root}/tmp/cache/entity") super Radiant::Cache.entity_stores << self end |
Instance Method Details
#clear ⇒ Object
38 39 40 |
# File 'lib/radiant/cache.rb', line 38 def clear Dir[File.join(self.root, "*")].each {|file| FileUtils.rm_rf(file) } end |
#write(body) ⇒ Object
42 43 44 45 46 |
# File 'lib/radiant/cache.rb', line 42 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 |