store.Read() returns honor Record.Expiry
This commit is contained in:
@@ -36,6 +36,11 @@ func (m *memoryStore) Dump() ([]*store.Record, error) {
|
||||
if d > time.Duration(0) && t > d {
|
||||
continue
|
||||
}
|
||||
|
||||
// update expiry
|
||||
v.r.Expiry -= t
|
||||
v.c = time.Now()
|
||||
|
||||
values = append(values, v.r)
|
||||
}
|
||||
|
||||
@@ -60,6 +65,10 @@ func (m *memoryStore) Read(key string) (*store.Record, error) {
|
||||
return nil, store.ErrNotFound
|
||||
}
|
||||
|
||||
// update expiry
|
||||
v.r.Expiry -= t
|
||||
v.c = time.Now()
|
||||
|
||||
return v.r, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user