Module: Sinatra::Cache

Defined in:
lib/sinatra/cache.rb

Overview

Sinatra Caching module

TODO:: Need to write documentation here

Defined Under Namespace

Modules: Helpers

Constant Summary collapse

VERSION =
'Sinatra::Cache v0.2.2'

Class Method Summary collapse

Class Method Details

.registered(app) ⇒ Object

Sets the default options:

* +:cache_enabled+ => toggle for the cache functionality. Default is: +true+
* +:cache_page_extension+ => sets the default extension for cached files. Default is: +.html+
* +:cache_dir+ => sets cache directory where cached files are stored. Default is: ''(empty) == root of /public.<br>
    set to empty, since the ideal 'system/cache/' does not work with Passenger & mod_rewrite :(
* +cache_logging+ => toggle for logging the cache calls. Default is: +true+
* +cache_logging_level+ => sets the level of the cache logger. Default is: <tt>:info</tt>.<br>
    Options:(unused atm) [:info, :warn, :debug]


126
127
128
129
130
131
132
133
# File 'lib/sinatra/cache.rb', line 126

def self.registered(app)
  app.helpers(Cache::Helpers)
  app.set :cache_enabled, true
  app.set :cache_page_extension, '.html'
  app.set :cache_output_dir, ''
  app.set :cache_logging, true
  app.set :cache_logging_level, :info
end

.versionObject



13
# File 'lib/sinatra/cache.rb', line 13

def self.version; VERSION; end