MCPcopy Index your code
hub / github.com/ByteStorage/FlyDB / setSetToDB

Method setSetToDB

structure/set.go:409–428  ·  view source on GitHub ↗

setSetToDB

(key []byte, zSetValue *FSets, ttl time.Duration)

Source from the content-addressed store, hash-verified

407
408// setSetToDB
409func (s *SetStructure) setSetToDB(key []byte, zSetValue *FSets, ttl time.Duration) error {
410 // create a new zSetValueWithTTL struct
411 var expire int64 = 0
412
413 if ttl != 0 {
414 expire = time.Now().Add(ttl).UnixNano()
415 }
416
417 valueWithTTL := &FSetWithTTL{
418 ZSet: zSetValue,
419 TTL: expire,
420 }
421
422 val := encoding.NewMessagePackEncoder()
423 err := val.Encode(valueWithTTL) // Encode the value along with TTL
424 if err != nil {
425 return err
426 }
427 return s.db.Put(key, val.Bytes())
428}
429
430func (s *SetStructure) exists(key string, member ...string) bool {
431 if err := checkKey(key); err != nil {

Callers 2

SAddsMethod · 0.95
SRemsMethod · 0.95

Calls 5

NewMessagePackEncoderFunction · 0.92
AddMethod · 0.80
PutMethod · 0.65
EncodeMethod · 0.45
BytesMethod · 0.45

Tested by

no test coverage detected