Class: Philiprehberger::Lru::Node Private
- Inherits:
-
Object
- Object
- Philiprehberger::Lru::Node
- Defined in:
- lib/philiprehberger/lru.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Node for the doubly-linked list
Instance Attribute Summary collapse
- #expires_at ⇒ Object private
- #key ⇒ Object private
- #next_node ⇒ Object private
- #prev_node ⇒ Object private
- #value ⇒ Object private
Instance Method Summary collapse
- #expired? ⇒ Boolean private
-
#initialize(key, value, expires_at: nil) ⇒ Node
constructor
private
A new instance of Node.
Constructor Details
#initialize(key, value, expires_at: nil) ⇒ Node
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Node.
15 16 17 18 19 20 21 |
# File 'lib/philiprehberger/lru.rb', line 15 def initialize(key, value, expires_at: nil) @key = key @value = value @expires_at = expires_at @prev_node = nil @next_node = nil end |
Instance Attribute Details
#expires_at ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
13 14 15 |
# File 'lib/philiprehberger/lru.rb', line 13 def expires_at @expires_at end |
#key ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
13 14 15 |
# File 'lib/philiprehberger/lru.rb', line 13 def key @key end |
#next_node ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
13 14 15 |
# File 'lib/philiprehberger/lru.rb', line 13 def next_node @next_node end |
#prev_node ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
13 14 15 |
# File 'lib/philiprehberger/lru.rb', line 13 def prev_node @prev_node end |
#value ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
13 14 15 |
# File 'lib/philiprehberger/lru.rb', line 13 def value @value end |
Instance Method Details
#expired? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 26 27 |
# File 'lib/philiprehberger/lru.rb', line 23 def expired? return false if @expires_at.nil? Time.now >= @expires_at end |