class CacheEntry

This is a node in the cache and is a wrapper for the object and keeps flags on the status of the entry.

Attributes

obj[RW]
oid[RW]

Public Class Methods

new(oid=nil,obj=nil,dirty=false,noswap=false) click to toggle source

perhaps add LRU counters as CacheEntry is pretty dumb

# File lib/storage/cache.rb, line 59
def initialize(oid=nil,obj=nil,dirty=false,noswap=false)
  @oid, @obj, @dirty, @noswap = oid, obj, dirty, noswap
end

Public Instance Methods

clean!() click to toggle source
# File lib/storage/cache.rb, line 72
def clean!
  @dirty = false
end
dead?() click to toggle source

A dead cache entry is an object that has been deleted

# File lib/storage/cache.rb, line 77
def dead?
  @obj == nil
end
dirty!() click to toggle source
# File lib/storage/cache.rb, line 68
def dirty!
  @dirty = true
end
dirty?() click to toggle source

dirty cache entries are those that probably differ from the database

# File lib/storage/cache.rb, line 64
def dirty?
  @dirty
end
mark_dead() click to toggle source
# File lib/storage/cache.rb, line 81
def mark_dead
  @obj = nil
  @oid = nil
  @dirty = false
  @noswap = false
end
noswap!() click to toggle source
# File lib/storage/cache.rb, line 96
def noswap!
  @noswap = true
end
noswap?() click to toggle source

Noswappable cache entries are objects that have non persistent attributes. *heavy sigh* We can never remove these from the cache until specifically marked See makenoswap and makeswap

# File lib/storage/cache.rb, line 92
def noswap?
  @noswap
end
swap!() click to toggle source
# File lib/storage/cache.rb, line 100
def swap!
  @noswap = false
end