mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 10:53:34 +00:00
rebase: update kubernetes to 1.28.0 in main
updating kubernetes to 1.28.0 in the main repo. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
b2fdc269c3
commit
ff3e84ad67
12
vendor/k8s.io/apimachinery/pkg/util/cache/expiring.go
generated
vendored
12
vendor/k8s.io/apimachinery/pkg/util/cache/expiring.go
generated
vendored
@ -40,6 +40,13 @@ func NewExpiringWithClock(clock clock.Clock) *Expiring {
|
||||
|
||||
// Expiring is a map whose entries expire after a per-entry timeout.
|
||||
type Expiring struct {
|
||||
// AllowExpiredGet causes the expiration check to be skipped on Get.
|
||||
// It should only be used when a key always corresponds to the exact same value.
|
||||
// Thus when this field is true, expired keys are considered valid
|
||||
// until the next call to Set (which causes the GC to run).
|
||||
// It may not be changed concurrently with calls to Get.
|
||||
AllowExpiredGet bool
|
||||
|
||||
clock clock.Clock
|
||||
|
||||
// mu protects the below fields
|
||||
@ -70,7 +77,10 @@ func (c *Expiring) Get(key interface{}) (val interface{}, ok bool) {
|
||||
c.mu.RLock()
|
||||
defer c.mu.RUnlock()
|
||||
e, ok := c.cache[key]
|
||||
if !ok || !c.clock.Now().Before(e.expiry) {
|
||||
if !ok {
|
||||
return nil, false
|
||||
}
|
||||
if !c.AllowExpiredGet && !c.clock.Now().Before(e.expiry) {
|
||||
return nil, false
|
||||
}
|
||||
return e.val, true
|
||||
|
Reference in New Issue
Block a user