Module: Vhost::RadiantCacheExtensions::RadiantCache

Defined in:
lib/vhost/radiant_cache_extensions.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/vhost/radiant_cache_extensions.rb', line 6

def self.included(base)
  base.class_eval {
    # This sets up the cache - the entitystore and metastore 'cache/entity' and 'cache/meta' sets up the folder
    # structure for storing the cache items.
    def self.new(app, options={})
      self.use_x_sendfile = options.delete(:use_x_sendfile) if options[:use_x_sendfile]
      self.use_x_accel_redirect = options.delete(:use_x_accel_redirect) if options[:use_x_accel_redirect]
      Rack::Cache.new(app, {
          :entitystore => "radiant:tmp/cache/entity", 
          :metastore => "radiant:tmp/cache/meta",
          :verbose => false}.merge(options))
    end
    def self.clear(host_and_url = nil)
      meta_stores.each {|ms| ms.clear(host_and_url) }
      entity_stores.each {|es| es.clear }
    end
  }
end