Sha256: bf0cc0ea2d22ee64394681657691a7cfdf452eb5cba6c4d29b894c230d5c759f

Contents?: true

Size: 572 Bytes

Versions: 3

Compression:

Stored size: 572 Bytes

Contents

require 'ramaze'

class MainController < Ramaze::Controller
  map :/

  helper :cache
  cache :index

  def index
%[
<html>
  <head><title>examples/caching</title></head>
  <body>
    <p>
      This action just shows you a random number: #{rand * 100}.<br />
      If you <a href="/">refresh</a> the page it won't change since you see a cached version.<br />
      But if you <a href="/invalidate">invalidate</a> it, the page will be regenerated.
    </p>
  </body>
</html>
]
  end

  def invalidate
    action_cache.delete '/index'
    redirect :/
  end
end

Ramaze.start

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ramaze-0.2.0 examples/caching.rb
ramaze-0.2.1 examples/caching.rb
ramaze-0.3.0 examples/caching.rb