Documentation
¶
Overview ¶
Package cache implements some cache utils.
Index ¶
Constants ¶
View Source
const (
// DefaultTTL is the duration for which we keep entries in the cache.
DefaultTTL = 10 * time.Minute
)
Variables ¶
This section is empty.
Functions ¶
func NewReconcileEntryKey ¶
func NewReconcileEntryKey(obj metav1.Object) string
NewReconcileEntryKey returns the key of a ReconcileEntry based on an object.
Types ¶
type Cache ¶
type Cache[E Entry] interface {
// Add adds the given entry to the Cache.
// Note: entries expire after the ttl.
Add(entry E)
// Has checks if the given key (still) exists in the Cache.
// Note: entries expire after the ttl.
Has(key string) (E, bool)
}
Cache caches objects of type Entry.
type Entry ¶
type Entry interface {
// Key returns the cache key of an Entry.
Key() string
}
Entry is the interface for the type of Cache entries.
type ReconcileEntry ¶
type ReconcileEntry struct {
Request ctrl.Request
ReconcileAfter time.Time
}
ReconcileEntry is an Entry for the Cache that stores the earliest time after which the next Reconcile should be executed.
func NewReconcileEntry ¶
func NewReconcileEntry(obj metav1.Object, reconcileAfter time.Time) ReconcileEntry
NewReconcileEntry creates a new ReconcileEntry based on an object and a reconcileAfter time.
func (ReconcileEntry) Key ¶
func (r ReconcileEntry) Key() string
Key returns the cache key of a ReconcileEntry.
func (ReconcileEntry) ShouldRequeue ¶
func (r ReconcileEntry) ShouldRequeue(now time.Time) (requeueAfter time.Duration, requeue bool)
ShouldRequeue returns if the current Reconcile should be requeued.
Click to show internal directories.
Click to hide internal directories.