Constructor.
Alias required by the subclasses.
Support for the 'in' operator
Obtains the index of the cache item that corresponds to node and updates the access time. If realtime is enabled, access_time is expected to be equal to or greater than the time stored in node. If disabled and the access time is less, the node will not be updated and a value of at least length returned.
Checks whether an item exists in the cache and returns the last time it was accessed.
Removes all items from the cache.
Checks whether an item exists in the cache.
Obtains the index of the cache item that corresponds to key and updates the access time. If realtime is enabled and key could be found, access_time is expected to be at least the time value stored in node. If disabled and access_time is less, the result is the same as if key could not be found.
Obtains the key of the cache item corresponding to index.
Obtains the current time. By default this is the wall clock time in seconds. This time value is used to find the least recently updated cache item and stored as create time. A subclass may override this method to use a different time unit or clock.
Obtains the time-to-index node for key.
Registers a new cache element and obtains the cache item index for it. If the cache is full, the oldest cache element is replaced. If realtime is enabled, time is expected to be at least the time value of the most recent cache element. If realtime is disabled and time is less than the time value of the most recent cache element, nothing is done and a value of at least length is returned.
Removes an item from the cache.
Removes the cache item that corresponds to dst_key and dst_node.
Called when a cache element is removed, replaces the cache items at index "replaced"" with the one at index "replace".
Resets the statistics counter values.
Called when the oldest item is replaced in cache with a new one because cache is full. When the cache gets full, the oldest item will be replaced with the new value. Before that happens, this method will be called, having the item index passed as a argument.
Called when the time value returned by now() is less than the time of last access of the oldest record in the cache; may be overridden by a subclass to be notified if this happens. With the system time as external data source this can theoretically happen and is at least not a program bug so in this class assert() would be inappropriate.
Mapping from key to TimeToIndex.Mapping struct (which contains a mapping from an access time to the index of an elements in this.items).
Counters for the cache lookups and misses.
Mapping from access time to the index of an item in the items array. The map is implemented with an EBTree, so that it is sorted in order of access times.
Resets the statistics counter values.