(k string)
| 455 | } |
| 456 | |
| 457 | func (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 | |
| 477 | func (s *SetStructure) Size(key string) (string, error) { |
| 478 |
nothing calls this directly
no test coverage detected