NewAutoRefreshCache
Instantiates a new AutoRefresh Cache that syncs items periodically.
def NewAutoRefreshCache(
name: string,
syncCb: SyncFunc,
syncRateLimiter: workqueue.TypedRateLimiter[*Batch],
resyncPeriod: time.Duration,
parallelizm: int,
size: int,
scope: promutils.Scope
) - > AutoRefresh, error
Instantiates a new AutoRefresh Cache that syncs items periodically.
Parameters
| Name | Type | Description |
|---|---|---|
| name | string | The name of the cache, used for identification and metrics. |
| syncCb | SyncFunc | The callback function to be executed for syncing items in the cache. |
| syncRateLimiter | workqueue.TypedRateLimiter[*Batch] | The rate limiter to control the frequency of sync operations. |
| resyncPeriod | time.Duration | The duration after which the cache will perform a full resync of its items. |
| parallelizm | int | The number of concurrent workers that can process sync operations. |
| size | int | The maximum number of items the cache can hold. |
| scope | promutils.Scope | The Prometheus metrics scope for reporting cache-related metrics. |
Returns
| Type | Description |
|---|---|
AutoRefresh, error | A new AutoRefresh instance and an error if the instantiation fails. |