Class: Factorix::Cache::Entry

Inherits:
Data
  • Object
show all
Defined in:
lib/factorix/cache/entry.rb,
lib/factorix/cache/entry.rb,
sig/factorix/cache/entry.rbs

Overview

Represents a cache entry for enumeration operations.

Used by Base#each to yield entry metadata alongside keys. Note: The key is NOT included in Entry; it is yielded separately.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize ⇒ Entry

Returns a new instance of Entry.

Parameters:

  • size: (Integer)
  • age: (Float)
  • expired: (Boolean)


11
# File 'sig/factorix/cache/entry.rbs', line 11

def initialize: (size: Integer, age: Float, expired: bool) -> void

Instance Attribute Details

#age ⇒ Float (readonly)

Returns age in seconds since creation/modification.

Returns:

  • (Float) —

    age in seconds since creation/modification



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

def age
  @age
end

#size ⇒ Integer (readonly)

Returns entry size in bytes.

Returns:

  • (Integer) —

    entry size in bytes



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

def size
  @size
end

Instance Method Details

#expired? ⇒ Boolean

Check if the cache entry has expired.

Returns:

  • (Boolean) —

    true if entry has exceeded TTL



22
# File 'lib/factorix/cache/entry.rb', line 22

def expired? = expired