GetWithExpiration returns the value with expiration or not found error.
(key []byte)
| 262 | |
| 263 | // GetWithExpiration returns the value with expiration or not found error. |
| 264 | func (cache *Cache) GetWithExpiration(key []byte) (value []byte, expireAt uint32, err error) { |
| 265 | hashVal := hashFunc(key) |
| 266 | segID := hashVal & segmentAndOpVal |
| 267 | cache.locks[segID].Lock() |
| 268 | value, expireAt, err = cache.segments[segID].get(key, nil, hashVal, false) |
| 269 | cache.locks[segID].Unlock() |
| 270 | return |
| 271 | } |
| 272 | |
| 273 | // GetWithExpirationAndBuf copies the value to the buf and gets with expiration or returns a not found error. |
| 274 | // This method doesn't allocate memory when the capacity of buf is greater or equal to value. |