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


67
68
69
# File 'lib/moneta/adapters/lruhash.rb', line 67

def key
  @key
end

#nextObject


67
68
69
# File 'lib/moneta/adapters/lruhash.rb', line 67

def next
  @next
end

#prevObject


67
68
69
# File 'lib/moneta/adapters/lruhash.rb', line 67

def prev
  @prev
end

#valueObject


67
68
69
# File 'lib/moneta/adapters/lruhash.rb', line 67

def value
  @value
end

Instance Method Details

#insert_after(entry) ⇒ Object


75
76
77
78
79
80
81
82
83
# File 'lib/moneta/adapters/lruhash.rb', line 75

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

69
70
71
72
73
# File 'lib/moneta/adapters/lruhash.rb', line 69

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