lotus/controller — pull request #14 by karlfreeman (2014-06-10 17:59:34+00:00)
Title: Cache Control

Having previously looked into [Grape](https://github.com/intridea/grape) I was a little dis-heartened to find it had no cache-control helpers built in. So [I went ahead and implemented them](https://github.com/karlfreeman/grape-cache_control). Given that I had the relatively simple logic to hand I figured I'd see what it looked like in Lotus.

```ruby
# Cache-Control:public,max-age=900
cache_control :public, max_age: 900

# Cache-Control:public,no-store,max-age=900,s-maxage=86400
cache_control :public, :no_store, max_age: 900, s_maxage:86400

# Cache-Control:public,no-store,max-age=900,s-maxage=86400
cache_control :public, :no_store, max_age: (Time.now + 900), s_maxage: (Time.now + 86400)

# Cache-Control:private,must-revalidate,max=age=0
cache_control :private, :must_revalidate, max_age: 0

# Cache-Control:public,max-age=900
# Expires:Tue, 25 Feb 2014 12:00:00 GMT
expires 900, :public

# Cache-Control:private,no-cache,no-store,max-age=900
# Expires:Tue, 25 Feb 2014 12:00:00 GMT
expires (Time.now + 900), :private, :no_store
```
We could have a combination of both types of methods?

```ruby
action 'Public' do
def call(params)
cache_control :public
end
end

action 'Private' do
cache_control :private
def call(params)
end
end
```

A WIP, hence the complete lack of documentation / nice code :beer:.