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

Method TTL

structure/set.go:457–475  ·  view source on GitHub ↗
(k string)

Source from the content-addressed store, hash-verified

455}
456
457func (s *SetStructure) TTL(k string) (int64, error) {
458 keyBytes := stringToBytesWithKey(k)
459 _, expire, err := s.getSetFromDB(keyBytes, false)
460 if err != nil {
461 return -1, err
462 }
463
464 now := time.Now().UnixNano() / int64(time.Second)
465 expire = expire / int64(time.Second)
466
467 remainingTTL := expire - now
468
469 //println("re",remainingTTL)
470 if remainingTTL <= 0 {
471 return 0, nil // Return 0 TTL for expired keys
472 }
473
474 return remainingTTL, nil
475}
476
477func (s *SetStructure) Size(key string) (string, error) {
478

Callers

nothing calls this directly

Calls 2

getSetFromDBMethod · 0.95
stringToBytesWithKeyFunction · 0.85

Tested by

no test coverage detected