From bf0fee122da742e95b9ae17294ef315c60bd773e Mon Sep 17 00:00:00 2001 From: Josh Baker Date: Wed, 14 Dec 2016 07:37:02 -0700 Subject: [PATCH] persist jset, jdel to aof. fixes #98 --- controller/json.go | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/controller/json.go b/controller/json.go index 30ed6ef2..b5d1e46b 100644 --- a/controller/json.go +++ b/controller/json.go @@ -178,8 +178,15 @@ func (c *Controller) cmdJset(msg *server.Message) (res string, d commandDetailsT if createcol { c.setCol(key, col) } + + d.key = key + d.id = id + d.obj = geojson.String(json) + d.timestamp = time.Now() + d.updated = true + c.clearIDExpires(key, id) - col.ReplaceOrInsert(id, geojson.String(json), nil, nil) + col.ReplaceOrInsert(d.id, d.obj, nil, nil) switch msg.OutputType { case server.JSON: var buf bytes.Buffer @@ -244,8 +251,15 @@ func (c *Controller) cmdJdel(msg *server.Message) (res string, d commandDetailsT // SET key id OBJECT json return c.cmdSet(&nmsg) } - c.clearIDExpires(key, id) - col.ReplaceOrInsert(id, geojson.String(json), nil, nil) + + d.key = key + d.id = id + d.obj = geojson.String(json) + d.timestamp = time.Now() + d.updated = true + + c.clearIDExpires(d.key, d.id) + col.ReplaceOrInsert(d.id, d.obj, nil, nil) switch msg.OutputType { case server.JSON: var buf bytes.Buffer