Documentation ¶
Index ¶
- type Cache
- func (c *Cache) GetAndResetHitMissCounters() (hit, miss uint64)
- func (c *Cache) GetCurrentCacheSize() (uint64, error)
- func (c *Cache) GetIntervalData(exeID host.FileID, interval *sdtypes.IntervalData) error
- func (c *Cache) HasIntervals(exeID host.FileID) bool
- func (c *Cache) SaveIntervalData(exeID host.FileID, interval *sdtypes.IntervalData) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache implements the `nativeunwind.IntervalCache` interface. It stores its cache data in a local sub-directory of `CacheDirectory`. The cache evicts data based on a LRU policy, with usage order preserved across HA restarts. If the cache grows larger than maxSize bytes elements will be removed from the cache before adding new ones, starting by the element with the oldest access time. To keep the order of the LRU cache across restarts, the population of the LRU is based on the access time information of existing elements.
func New ¶
New creates a new Cache using `path.Join(config.CacheDirectory(), cacheDirPathSuffix())` as the data directory for the cache. If that directory does not exist it will be created. However, `CacheDirectory` itself must already exist.
func (*Cache) GetAndResetHitMissCounters ¶
GetAndResetHitMissCounters retrieves the current hit and miss counters and resets them to 0.
func (*Cache) GetCurrentCacheSize ¶
GetCurrentCacheSize returns the current size of all elements in the cache.
func (*Cache) GetIntervalData ¶
GetIntervalData loads the interval data from the cache that is associated with `exeID` into `interval`.
func (*Cache) HasIntervals ¶
HasIntervals returns true if interval data exists in the cache for a file with the provided ID, or false otherwise.
func (*Cache) SaveIntervalData ¶
SaveIntervalData stores the provided `interval` that is associated with `exeID` in the cache.