Class TaskJuggler::DataCacheEntry
In: lib/taskjuggler/DataCache.rb
Parent: Object

These are the entries in the DataCache. They store a value and an access counter. The counter can be read and written externally.

Methods

new   value  

Attributes

hits  [RW] 
unhashedKey  [R] 

Public Class methods

Create a new DataCacheEntry for the value. We also store the unhashed key to be able to detect hash collisions. The access counter is set to 1 to increase the chance that it is not flushed immedidate.

[Source]

# File lib/taskjuggler/DataCache.rb, line 29
    def initialize(unhashedKey, value)
      @unhashedKey = unhashedKey
      @value = value
      @hits = 1
    end

Public Instance methods

Return the value and increase the access counter by 1.

[Source]

# File lib/taskjuggler/DataCache.rb, line 36
    def value
      if @hits <= 0
        @hits = 1
      else
        @hits += 1
      end
      @value
    end

[Validate]