{"action":"created","issue":{"url":"https://api.github.com/repos/mediocregopher/radix.v2/issues/44","repository_url":"https://api.github.com/repos/mediocregopher/radix.v2","labels_url":"https://api.github.com/repos/mediocregopher/radix.v2/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/mediocregopher/radix.v2/issues/44/comments","events_url":"https://api.github.com/repos/mediocregopher/radix.v2/issues/44/events","html_url":"https://github.com/mediocregopher/radix.v2/issues/44","id":178924523,"number":44,"title":"how can i use this for transactions command 'watch,mutil,...,exec,unwatch'","user":{"login":"jiangyoucai","id":9425368,"avatar_url":"https://avatars.githubusercontent.com/u/9425368?v=3","gravatar_id":"","url":"https://api.github.com/users/jiangyoucai","html_url":"https://github.com/jiangyoucai","followers_url":"https://api.github.com/users/jiangyoucai/followers","following_url":"https://api.github.com/users/jiangyoucai/following{/other_user}","gists_url":"https://api.github.com/users/jiangyoucai/gists{/gist_id}","starred_url":"https://api.github.com/users/jiangyoucai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiangyoucai/subscriptions","organizations_url":"https://api.github.com/users/jiangyoucai/orgs","repos_url":"https://api.github.com/users/jiangyoucai/repos","events_url":"https://api.github.com/users/jiangyoucai/events{/privacy}","received_events_url":"https://api.github.com/users/jiangyoucai/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-23T16:51:23Z","updated_at":"2016-09-24T20:44:50Z","closed_at":"2016-09-24T20:44:50Z","body":"I am building a web store\r\nI use locks and transactions to ensure proper inventory\r\nBut how do I use the transaction?\r\nI wrote the following code\r\nBut I'm not sure this is right\r\n```\r\n\t_ = cache.Conn.Cmd(\"WATCH\", \"5\")\r\n\td, err := cache.Conn.Cmd(\"GET\", \"5\").Str()\r\n\tif err == nil && d == \"5\" {\r\n\t\tcache.Conn.PipeAppend(\"MULTI\")\r\n\t\tcache.Conn.PipeAppend(\"SET\", \"key1\", \"1\")\r\n\t\tcache.Conn.PipeAppend(\"SET\", \"key2\", \"2\")\r\n\t\tcache.Conn.PipeAppend(\"SET\", \"key3\", \"3\")\r\n\t\tcache.Conn.PipeAppend(\"SET\", \"key4\", \"4\")\r\n\t\tcache.Conn.PipeAppend(\"SET\", \"key5\", \"5\")\r\n\t\tcache.Conn.PipeAppend(\"EXEC\")\r\n\t\t_ = cache.Conn.PipeResp()\r\n\t}\r\n\tcache.Conn.Cmd(\"UNWATCH\")\r\n```\r\nCan you give me some suggestions ?"},"comment":{"url":"https://api.github.com/repos/mediocregopher/radix.v2/issues/comments/249386600","html_url":"https://github.com/mediocregopher/radix.v2/issues/44#issuecomment-249386600","issue_url":"https://api.github.com/repos/mediocregopher/radix.v2/issues/44","id":249386600,"user":{"login":"mediocregopher","id":933154,"avatar_url":"https://avatars.githubusercontent.com/u/933154?v=3","gravatar_id":"","url":"https://api.github.com/users/mediocregopher","html_url":"https://github.com/mediocregopher","followers_url":"https://api.github.com/users/mediocregopher/followers","following_url":"https://api.github.com/users/mediocregopher/following{/other_user}","gists_url":"https://api.github.com/users/mediocregopher/gists{/gist_id}","starred_url":"https://api.github.com/users/mediocregopher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mediocregopher/subscriptions","organizations_url":"https://api.github.com/users/mediocregopher/orgs","repos_url":"https://api.github.com/users/mediocregopher/repos","events_url":"https://api.github.com/users/mediocregopher/events{/privacy}","received_events_url":"https://api.github.com/users/mediocregopher/received_events","type":"User","site_admin":false},"created_at":"2016-09-24T20:44:50Z","updated_at":"2016-09-24T20:44:50Z","body":"No problem! If you're used to openresty then you should have no problem here, redis' lua support is way simpler. I'll go ahead and close this now, but feel free to open it back up if you've got any other questions."}}
{"actor":{"display_login":"mediocregopher"}}