class TaskJuggler::DataCacheEntry
These are the entries in the DataCache
. They store a value and an access counter. The counter can be read and written externally.
Attributes
hits[RW]
unhashedKey[R]
Public Class Methods
new(unhashedKey, value)
click to toggle source
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.
# File lib/taskjuggler/DataCache.rb, line 29 def initialize(unhashedKey, value) @unhashedKey = unhashedKey @value = value @hits = 1 end
Public Instance Methods
value()
click to toggle source
Return the value and increase the access counter by 1.
# File lib/taskjuggler/DataCache.rb, line 36 def value if @hits <= 0 @hits = 1 else @hits += 1 end @value end