MCPcopy Create free account
hub / github.com/nutsdb/nutsdb / IsExpire

Method IsExpire

internal/data/list.go:438–460  ·  view source on GitHub ↗
(key string)

Source from the content-addressed store, hash-verified

436}
437
438func (l *List) IsExpire(key string) bool {
439 if l == nil {
440 return false
441 }
442
443 _, ok := l.TTL[key]
444 if !ok {
445 return false
446 }
447
448 now := time.Now().Unix()
449 timestamp := l.TimeStamp[key]
450 if l.TTL[key] > 0 && uint64(l.TTL[key])+timestamp > uint64(now) || l.TTL[key] == uint32(0) {
451 return false
452 }
453
454 delete(l.Items, key)
455 delete(l.TTL, key)
456 delete(l.TimeStamp, key)
457 delete(l.Seq, key)
458
459 return true
460}
461
462func (l *List) Size(key string) (int, error) {
463 if l.IsExpire(key) {

Callers 14

TestList_ErrListNotFoundFunction · 0.95
PushMethod · 0.95
LPopMethod · 0.95
RPopMethod · 0.95
peekMethod · 0.95
GetRemoveIndexesMethod · 0.95
LTrimMethod · 0.95
LRemByIndexMethod · 0.95
SizeMethod · 0.95
GetListTTLMethod · 0.95
CheckExpireMethod · 0.80

Calls 1

deleteFunction · 0.85

Tested by 2

TestList_ErrListNotFoundFunction · 0.76