BBC-News/alephant-broker — pull request #24 by revett (2014-11-03 16:12:49+00:00)
Title: Set custom TTL in Cache

Issue [#21](https://github.com/BBC-News/alephant-broker/issues/21) raised by @stevenjack.

#### Problem

Unable to set TTL on a per object basis, when using [Cache](https://github.com/BBC-News/alephant-broker/blob/master/lib/alephant/broker/cache.rb) class.

#### Solution

* Allow TTL to be set in [.set](https://github.com/BBC-News/alephant-broker/blob/master/lib/alephant/broker/cache.rb#L49) method.
* Have the TTL set to `nil` if no value is given.
* [Dalli](https://github.com/mperham/dalli/blob/master/lib/dalli/client.rb#L101) then defaults to the TTL given when the cache client was initialised, if TTL is `nil`.
* Therefore does not change current interface.

![image.gif](http://i.imgur.com/VnzsLOe.gif)