Class: SoftEvictCache::SingleValueCache::Entry

Inherits:
Struct
  • Object
show all
Defined in:
lib/soft_evict_cache/single_value_cache.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hard_evict_atObject

Returns the value of attribute hard_evict_at

Returns:

  • (Object)

    the current value of hard_evict_at



9
10
11
# File 'lib/soft_evict_cache/single_value_cache.rb', line 9

def hard_evict_at
  @hard_evict_at
end

#soft_evict_atObject

Returns the value of attribute soft_evict_at

Returns:

  • (Object)

    the current value of soft_evict_at



9
10
11
# File 'lib/soft_evict_cache/single_value_cache.rb', line 9

def soft_evict_at
  @soft_evict_at
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



9
10
11
# File 'lib/soft_evict_cache/single_value_cache.rb', line 9

def value
  @value
end

Instance Method Details

#soft_evicted?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/soft_evict_cache/single_value_cache.rb', line 10

def soft_evicted?
  soft_evict_at < Time.now
end

#valid?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/soft_evict_cache/single_value_cache.rb', line 14

def valid?
  Time.now < hard_evict_at
end