Skip to content

Commit 009eebc

Browse files
harjotgillburaksezer
authored andcommitted
use PutEx opcode when using ttl
1 parent c27a4c3 commit 009eebc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

internal/dmap/atomic.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ func (dm *DMap) loadCurrentAtomicInt(e *env) (int, int64, error) {
3232
return 0, 0, err
3333
}
3434

35-
var current int
3635
if entry != nil {
36+
var current int
3737
var value interface{}
3838
if err := dm.s.serializer.Unmarshal(entry.Value(), &value); err != nil {
3939
return 0, 0, err
@@ -44,7 +44,7 @@ func (dm *DMap) loadCurrentAtomicInt(e *env) (int, int64, error) {
4444
}
4545
return current, entry.TTL(), nil
4646
}
47-
return current, 0, nil
47+
return 0, 0, nil
4848
}
4949

5050
func (dm *DMap) atomicIncrDecr(opcode protocol.OpCode, e *env, delta int) (int, error) {
@@ -79,6 +79,7 @@ func (dm *DMap) atomicIncrDecr(opcode protocol.OpCode, e *env, delta int) (int,
7979

8080
if ttl != 0 {
8181
e.timeout = time.Until(time.UnixMilli(ttl))
82+
e.opcode = protocol.OpPutEx
8283
}
8384
e.value = val
8485
err = dm.put(e)

0 commit comments

Comments
 (0)