MCPcopy
hub / github.com/kubernetes/client-go / ExpirationCache

Struct ExpirationCache

tools/cache/expiration_cache.go:38–46  ·  view source on GitHub ↗

ExpirationCache implements the store interface 1. All entries are automatically time stamped on insert a. The key is computed based off the original item/keyFunc b. The value inserted under that key is the timestamped item 2. Expiration happens lazily on read based on the expiration policy a.

Source from the content-addressed store, hash-verified

36// threadSafeStore because it takes a write lock every time it checks if
37// an item has expired.
38type ExpirationCache struct {
39 cacheStorage ThreadSafeStore
40 keyFunc KeyFunc
41 clock clock.Clock
42 expirationPolicy ExpirationPolicy
43 // expirationLock is a write lock used to guarantee that we don't clobber
44 // newly inserted objects because of a stale expiration timestamp comparison
45 expirationLock sync.Mutex
46}
47
48// ExpirationPolicy dictates when an object expires. Currently only abstracted out
49// so unittests don't rely on the system clock.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected