Reputation: 49
I am developing sinatra web app and I would like to cache in server-side with sinatra-cache gem.
http://www.rubydoc.info/gems/sinatra-cache/0.3.7/frames
I can install it and it worked. But now it cache all method.
Next what I want to do is limit a specific method to cache.
For example,
get '/cache-me'
will be cached but
get '/nocache'
won't be cached.
How can I control this ?
And also once cached , I want to expire after specified time duration. How can I do it ?
Upvotes: 1
Views: 1434
Reputation: 1862
You have to disable cache by your self.
In your get
methods, just add no-cache parameter :cache => false
to erb
or haml
calls. E.g.:
# To turn off caching on certain pages:
get('/nocahce') {
haml(:view_name, :cache => false) # <- here
}
Take a look on documentation for more details. Have a nice day!
Upvotes: 2