Class: Rospatent::Cache::CacheEntry

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

Overview

Cache entry with value and expiration time

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#access_countObject

Returns the value of attribute access_count

Returns:

  • (Object)

    the current value of access_count



11
12
13
# File 'lib/rospatent/cache.rb', line 11

def access_count
  @access_count
end

#created_atObject

Returns the value of attribute created_at

Returns:

  • (Object)

    the current value of created_at



11
12
13
# File 'lib/rospatent/cache.rb', line 11

def created_at
  @created_at
end

#expires_atObject

Returns the value of attribute expires_at

Returns:

  • (Object)

    the current value of expires_at



11
12
13
# File 'lib/rospatent/cache.rb', line 11

def expires_at
  @expires_at
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



11
12
13
# File 'lib/rospatent/cache.rb', line 11

def value
  @value
end

Instance Method Details

#expired?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/rospatent/cache.rb', line 12

def expired?
  Time.now > expires_at
end

#touch!Object



16
17
18
# File 'lib/rospatent/cache.rb', line 16

def touch!
  self.access_count += 1
end