Class: Async::Cache::Item

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at

Returns:

  • (Object)

    the current value of created_at



4
5
6
# File 'lib/async/cache.rb', line 4

def created_at
  @created_at
end

#durationObject

Returns the value of attribute duration

Returns:

  • (Object)

    the current value of duration



4
5
6
# File 'lib/async/cache.rb', line 4

def duration
  @duration
end

#taskObject

Returns the value of attribute task

Returns:

  • (Object)

    the current value of task



4
5
6
# File 'lib/async/cache.rb', line 4

def task
  @task
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



4
5
6
# File 'lib/async/cache.rb', line 4

def value
  @value
end

Instance Method Details

#expired?Boolean

Returns:

  • (Boolean)


5
# File 'lib/async/cache.rb', line 5

def expired? = created_at && Time.now - created_at >= duration