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

Method CheckExpire

tx_list.go:491–512  ·  view source on GitHub ↗
(bucket string, key []byte)

Source from the content-addressed store, hash-verified

489}
490
491func (tx *Tx) CheckExpire(bucket string, key []byte) bool {
492 b, err := tx.db.bucketMgr.GetBucket(DataStructureList, bucket)
493 if err != nil {
494 return false
495 }
496
497 var (
498 bucketId = b.Id
499 l *data.List
500 exist bool
501 )
502
503 if l, exist = tx.db.Index.List.exist(bucketId); !exist {
504 return false
505 }
506
507 if l.IsExpire(string(key)) {
508 _ = tx.push(bucket, key, DataDeleteFlag)
509 return true
510 }
511 return false
512}
513
514func (tx *Tx) GetListTTL(bucket string, key []byte) (uint32, error) {
515 if err := tx.checkTxIsClosed(); err != nil {

Callers 8

RPeekMethod · 0.95
isKeyValidMethod · 0.95
LPeekMethod · 0.95
LSizeMethod · 0.95
LRangeMethod · 0.95
LTrimMethod · 0.95
LRemByIndexMethod · 0.95
LKeysMethod · 0.95

Calls 4

pushMethod · 0.95
GetBucketMethod · 0.80
existMethod · 0.80
IsExpireMethod · 0.80

Tested by

no test coverage detected