NearCache¶
-
lru_cmp(x, y)¶ Least recently used comparison.
Parameters: - x – (
DataRecord), first record to be compared. - y – (
DataRecord), second record to be compared.
Returns: (int), -1 if first record is older, 0 if records have same last access time, 1 if second record is older.
- x – (
-
lfu_cmp(x, y)¶ Least frequently used comparison.
Parameters: - x – (
DataRecord), first record to be compared. - y – (
DataRecord), second record to be compared.
Returns: (int), positive if first record is accessed more than second, 0 in equality, otherwise negative.
- x – (
-
random_cmp(x, y)¶ Random comparison.
Parameters: - x – (
DataRecord), first record to be compared. - y – (
DataRecord), second record to be compared.
Returns: (int), 0.
- x – (
-
class
DataRecord(key, value, create_time=None, ttl_seconds=None)¶ Bases:
objectAn expirable and evictable data object which represents a cache entry.
-
is_expired(max_idle_seconds)¶ Determines whether this record is expired or not.
Parameters: max_idle_seconds – (long), the maximum idle time of record, maximum time after the last access time. Returns: (bool), trueis this record is not expired.
-
-
class
NearCache(serialization_service, in_memory_format, time_to_live_seconds, max_idle_seconds, invalidate_on_change, eviction_policy, eviction_max_size, eviction_sampling_count=None, eviction_sampling_pool_size=None)¶ Bases:
dictNearCache is a local cache used by
MapFeatNearCache.-
logger= <logging.Logger object>¶
-
get_statistics()¶ Returns the statistics of the NearCache. :return: (Number, Number), evicted entry count and expired entry count.
-