Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A Sinatra Extension that makes Page and Fragment Caching easy
Ruby
tag: pre_0.9_version

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
LICENSE
README.textile

README.textile

Sinatra::Cache

Adds simple Page Caching to Sinatra

TODOs

NB! Very unfinished work, so use with care.

  1. Write tests
  2. Add logging output
  3. Move the configurations

Configuration

Example:


  1. toggle for cache functionality
    set :cache_enabled, true
  2. default extension for caching
    set :cache_page_extension, ‘.html’
  3. set Cache dir to Root of Public.
    set :cache_dir, ‘system/cache/’

Usage

Basic Page Caching into static HTML files


  get '/contact' do
    cache( erb( :contact, :layout => :layout))
  end

Expiring old pages (ie: after POST or PUT events)


  # not very good example
  post '/contact' do
    expire_cache( '/contact')
  end

Credits

Inspired by code from Rails & Merb
and sinatra-mailer

Something went wrong with that request. Please try again.