Class: Moneta::Adapters::LRUHash::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/moneta/adapters/lruhash.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#keyObject


79
80
81
# File 'lib/moneta/adapters/lruhash.rb', line 79

def key
  @key
end

#nextObject


79
80
81
# File 'lib/moneta/adapters/lruhash.rb', line 79

def next
  @next
end

#prevObject


79
80
81
# File 'lib/moneta/adapters/lruhash.rb', line 79

def prev
  @prev
end

#valueObject


79
80
81
# File 'lib/moneta/adapters/lruhash.rb', line 79

def value
  @value
end

Instance Method Details

#insert_after(entry) ⇒ Object


87
88
89
90
91
92
93
94
95
# File 'lib/moneta/adapters/lruhash.rb', line 87

def insert_after(entry)
  if entry.next != self
    unlink
    @next = entry.next
    @prev = entry
    entry.next.prev = self
    entry.next = self
  end
end

81
82
83
84
85
# File 'lib/moneta/adapters/lruhash.rb', line 81

def unlink
  @prev.next = @next if @prev
  @next.prev = @prev if @next
  @prev = @next = nil
end