Padrino::Cache::Helpers::Page

Module: Padrino::Cache::Helpers::Page

Overview

Page caching is easy to integrate into your application. To turn it on, simply provide the :cache => true option on either a controller or one of its routes. By default, cached content is persisted with a “file store” –that is, in a subdirectory of your application root.

You can manually expire cache with CachedApp.cache.delete(:my_name)

Note that the “latest” method call to expires determines its value: if called within a route, as opposed to a controller definition, the route's value will be assumed.

Examples:

# Setting content expiry time.
class CachedApp < Padrino::Application
  enable :caching          # turns on caching mechanism

  controller '/blog', :cache => true do
    expires 15

    get '/entries' do
      # expires 15 =