Class: Cream::CacheItem

Inherits:
Object
  • Object
show all
Defined in:
lib/cream/cache_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, expires_at) ⇒ CacheItem

Returns a new instance of CacheItem.



5
6
7
8
# File 'lib/cream/cache_item.rb', line 5

def initialize(value, expires_at)
  @value = value
  @expires_at = expires_at
end

Instance Attribute Details

#expires_atObject (readonly)

Returns the value of attribute expires_at.



3
4
5
# File 'lib/cream/cache_item.rb', line 3

def expires_at
  @expires_at
end

#valueObject (readonly)

Returns the value of attribute value.



3
4
5
# File 'lib/cream/cache_item.rb', line 3

def value
  @value
end

Instance Method Details

#expired?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/cream/cache_item.rb', line 10

def expired?
  Time.now > expires_at
end