Class: Cache::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/cache/config.rb

Instance Method Summary collapse

Instance Method Details

#default_ttlObject

Get the currently set TTL.

Returns an Integer in seconds.



22
23
24
# File 'lib/cache/config.rb', line 22

def default_ttl
  @default_ttl
end

#default_ttl=(seconds) ⇒ Object

Set the default TTL that keys will live when not specifying a TTL.

ttl - Integer in seconds.

Example:

cache.config.default_ttl = 120
cache.set('foo', 'val')  # equivalent to set('foo', 'val', 120)


14
15
16
# File 'lib/cache/config.rb', line 14

def default_ttl=(seconds)
  @default_ttl = seconds
end