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
Public Class Methods
Source
# File lib/taskjuggler/DataCache.rb, line 30 def initialize(unhashedKey, value) @unhashedKey = unhashedKey @value = value @hits = 1 end
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.
Public Instance Methods
Source
# File lib/taskjuggler/DataCache.rb, line 37 def value if @hits <= 0 @hits = 1 else @hits += 1 end @value end
Return the value and increase the access counter by 1.