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


109
110
111
# File 'lib/moneta/adapters/lruhash.rb', line 109

def key
  @key
end

#nextObject


109
110
111
# File 'lib/moneta/adapters/lruhash.rb', line 109

def next
  @next
end

#prevObject


109
110
111
# File 'lib/moneta/adapters/lruhash.rb', line 109

def prev
  @prev
end

#valueObject


109
110
111
# File 'lib/moneta/adapters/lruhash.rb', line 109

def value
  @value
end

Instance Method Details

#insert_after(entry) ⇒ Object


117
118
119
120
121
122
123
124
125
# File 'lib/moneta/adapters/lruhash.rb', line 117

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

111
112
113
114
115
# File 'lib/moneta/adapters/lruhash.rb', line 111

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