NearCache¶
-
lru_key_func
(x)¶ Least Recently Used key function.
Parameters: x – ( DataRecord
)Returns: (float), last access time of x.
-
lfu_key_func
(x)¶ Least Frequently Used key function.
Parameters: x – ( DataRecord
)Returns: (int), access hit count of x.
-
random_key_func
(x)¶ Random key function.
Parameters: x – ( DataRecord
)Returns: (int), 0.
-
class
DataRecord
(key, value, create_time=None, ttl_seconds=None)¶ Bases:
object
An 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), true
is 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:
dict
NearCache 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.
-