mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-24 10:07:04 +02:00
update expiry only if it is non-zero
This commit is contained in:
parent
3abe3aa28b
commit
c8d57032bc
@ -38,8 +38,10 @@ func (m *memoryStore) Dump() ([]*store.Record, error) {
|
||||
}
|
||||
|
||||
// update expiry
|
||||
v.r.Expiry -= t
|
||||
v.c = time.Now()
|
||||
if d > time.Duration(0) {
|
||||
v.r.Expiry -= t
|
||||
v.c = time.Now()
|
||||
}
|
||||
|
||||
values = append(values, v.r)
|
||||
}
|
||||
@ -66,8 +68,10 @@ func (m *memoryStore) Read(key string) (*store.Record, error) {
|
||||
}
|
||||
|
||||
// update expiry
|
||||
v.r.Expiry -= t
|
||||
v.c = time.Now()
|
||||
if d > time.Duration(0) {
|
||||
v.r.Expiry -= t
|
||||
v.c = time.Now()
|
||||
}
|
||||
|
||||
return v.r, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user