{"action":"opened","issue":{"url":"https://api.github.com/repos/phpredis/phpredis/issues/593","labels_url":"https://api.github.com/repos/phpredis/phpredis/issues/593/labels{/name}","comments_url":"https://api.github.com/repos/phpredis/phpredis/issues/593/comments","events_url":"https://api.github.com/repos/phpredis/phpredis/issues/593/events","html_url":"https://github.com/phpredis/phpredis/issues/593","id":74246650,"number":593,"title":"discuss array support of sadd again","user":{"login":"netweaver","id":618441,"avatar_url":"https://avatars.githubusercontent.com/u/618441?v=3","gravatar_id":"","url":"https://api.github.com/users/netweaver","html_url":"https://github.com/netweaver","followers_url":"https://api.github.com/users/netweaver/followers","following_url":"https://api.github.com/users/netweaver/following{/other_user}","gists_url":"https://api.github.com/users/netweaver/gists{/gist_id}","starred_url":"https://api.github.com/users/netweaver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/netweaver/subscriptions","organizations_url":"https://api.github.com/users/netweaver/orgs","repos_url":"https://api.github.com/users/netweaver/repos","events_url":"https://api.github.com/users/netweaver/events{/privacy}","received_events_url":"https://api.github.com/users/netweaver/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-08T06:11:06Z","updated_at":"2015-05-08T06:11:06Z","closed_at":null,"body":"I suggest add a new method such as sMadd($key,$array) to explicitly indicate $array is an array of values would be add to set (only its values need to be serialized)\r\n\r\nthe sMadd method parses array values to redis protocol : 'sadd key value1 value2 ... '\r\n\r\nor modify sadd method to sadd($key,$valueOrArray,$isArray=FALSE)\r\n\r\ni also noticed that call_user_func_array is suggested\r\n\r\nbut consider this situation\r\n\r\n$resultArray = $db->query( ' select value from table\")->result()\r\n$valueArr=array_values($resultArray);\r\nif we should use call_user_func_array, we need put key of set on top of $valueArr\r\nso we need to do this;\r\narray_unshift($valueArr, $key);\r\nthen\r\ncall_user_func_array(array($redis, \"sadd\"), $valueArr);\r\n\r\nbut performance of array_unshift is terrible when $valueArr is a huge array\r\n\r\nmaybe it is a little bit better to use array_push and array_reverse as below:\r\n\r\narray_push($valueArr,$key);\r\n$newArr = array_reverse($valueArr);\r\ncall_user_func_array(array($redis, \"sadd\"), $newArr);\r\n\r\nbut it takes more memory\r\n\r\nso , i do suggest to consider my advise."}}