Expire sets the expiration time of a key
(key string, ttl int64)
| 350 | |
| 351 | // Expire sets the expiration time of a key |
| 352 | func (s *StringStructure) Expire(key string, ttl int64) error { |
| 353 | // Get the value |
| 354 | oldValue, err := s.Get(key) |
| 355 | if err != nil { |
| 356 | return err |
| 357 | } |
| 358 | |
| 359 | // Set the value |
| 360 | return s.Set(key, oldValue, ttl) |
| 361 | } |
| 362 | |
| 363 | // Persist removes the expiration time of a key |
| 364 | func (s *StringStructure) Persist(key string) error { |