Documentation
¶
Index ¶
Constants ¶
const ( // DefaultPreStopCacheSize is the default maximum number of containers to track DefaultPreStopCacheSize = 1000 // DefaultPreStopCacheTTL is the default time-to-live for cache entries DefaultPreStopCacheTTL = 5 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
func AP ¶
func AP(objectCache objectcache.ObjectCache, config config.Config) cel.EnvOption
func New ¶
func New(objectCache objectcache.ObjectCache, config config.Config) libraries.Library
Types ¶
type PreStopHookCache ¶ added in v0.3.8
type PreStopHookCache struct {
// contains filtered or unexported fields
}
PreStopHookCache tracks which containers have had their preStop hook triggered. It uses an LRU cache with time-based expiration to automatically clean up old entries and limit memory usage.
func GetPreStopHookCache ¶ added in v0.3.8
func GetPreStopHookCache() *PreStopHookCache
GetPreStopHookCache returns the global preStop hook cache singleton. The cache is lazily initialized with default settings on first call.
func NewPreStopHookCache ¶ added in v0.3.8
func NewPreStopHookCache(maxSize int, ttl time.Duration) *PreStopHookCache
NewPreStopHookCache creates a new preStop hook cache with the specified maximum size and TTL duration.
func (*PreStopHookCache) Len ¶ added in v0.3.8
func (c *PreStopHookCache) Len() int
Len returns the current number of entries in the cache.
func (*PreStopHookCache) MarkPreStopTriggered ¶ added in v0.3.8
func (c *PreStopHookCache) MarkPreStopTriggered(containerID string)
MarkPreStopTriggered marks that the preStop hook was triggered for the given container ID. The entry will automatically expire after the cache's TTL duration.
func (*PreStopHookCache) Remove ¶ added in v0.3.8
func (c *PreStopHookCache) Remove(containerID string)
Remove removes a container ID from the cache.
func (*PreStopHookCache) WasPreStopTriggered ¶ added in v0.3.8
func (c *PreStopHookCache) WasPreStopTriggered(containerID string) bool
WasPreStopTriggered returns true if the preStop hook was triggered for the given container ID and the entry has not yet expired.