class Bio::GFFbrowser::Digest::LruTracker

Attributes

cache[R]
calls[RW]
hits[RW]
misses[RW]

Public Class Methods

new() click to toggle source
# File lib/bio/db/gff/digest/gfflrucache.rb, line 109
def initialize 
  @cache = LRUHash.new 50000
  @hits = 0
  @misses = 0
  @calls = 0
end

Public Instance Methods

[](name) click to toggle source
# File lib/bio/db/gff/digest/gfflrucache.rb, line 116
def [](name)
  @calls += 1
  item = @cache[name]
  if @cache[name] == nil
    @misses += 1
  else
    @hits += 1
  end
  item
end
[]=(name,item) click to toggle source
# File lib/bio/db/gff/digest/gfflrucache.rb, line 127
def []=(name,item)
  @cache[name] = item
end
display(msg) click to toggle source
# File lib/bio/db/gff/digest/gfflrucache.rb, line 130
def display msg
  info "Cache calls #{msg}  = #{@calls}" 
  info "Cache hits #{msg}   = #{@hits}" 
  info "Cache misses #{msg} = #{@misses}" 
end