NewAutoRefreshCache
No overview available.
def NewAutoRefreshCache(
syncCb: CacheSyncItem,
syncRateLimiter: RateLimiter,
resyncPeriod: time.Duration,
size: int,
scope: promutils.Scope
) - > AutoRefreshCache, error
Deprecated: This utility is deprecated, it has been refactored and moved into cache package. Creates a new AutoRefreshCache instance. This function initializes a cache that automatically refreshes its items based on a provided synchronization callback and rate limiter.
Parameters
| Name | Type | Description |
|---|---|---|
| syncCb | CacheSyncItem | The callback function used to synchronize items within the cache. |
| syncRateLimiter | RateLimiter | The rate limiter to control the frequency of synchronization operations. |
| resyncPeriod | time.Duration | The duration after which the cache should attempt to resynchronize its items. |
| size | int | The maximum number of items the cache can hold before evicting older items. |
| scope | promutils.Scope | The Prometheus scope used for metrics, specifically to log evictions from the LRU cache. Can be nil if metrics are not required. |
Returns
| Type | Description |
|---|---|
AutoRefreshCache, error | A new AutoRefreshCache instance and an error if the cache could not be created. |