Class CacheEntry
In: lib/storage/cache.rb
Parent: Object
CacheStats
CacheManager
CacheEntry
dot/f_42.png

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

Methods

clean!   dead?   dirty!   dirty?   mark_dead   new   noswap!   noswap?   swap!  

Attributes

obj  [RW] 
oid  [RW] 

Public Class methods

perhaps add LRU counters as CacheEntry is pretty dumb

[Source]

# 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

[Source]

# File lib/storage/cache.rb, line 72
  def clean!
    @dirty = false
  end

A dead cache entry is an object that has been deleted

[Source]

# File lib/storage/cache.rb, line 77
  def dead?
    @obj == nil
  end

[Source]

# File lib/storage/cache.rb, line 68
  def dirty!
    @dirty = true
  end

dirty cache entries are those that probably differ from the database

[Source]

# File lib/storage/cache.rb, line 64
  def dirty?
    @dirty
  end

[Source]

# File lib/storage/cache.rb, line 81
  def mark_dead
    @obj = nil
    @oid = nil
    @dirty = false
    @noswap = false
  end

[Source]

# File lib/storage/cache.rb, line 96
  def noswap!
    @noswap = true
  end

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

[Source]

# File lib/storage/cache.rb, line 92
  def noswap?
    @noswap
  end

[Source]

# File lib/storage/cache.rb, line 100
  def swap!
    @noswap = false
  end

[Validate]