@@ -20,10 +20,11 @@ trait GeoCommandsTrait {
2020
2121 /**
2222 * GEOADD key longitude latitude member [longitude latitude member ...]
23- * Beta Not yet available in a stable version of Redis. Download unstable if you want to test this command .
23+ * Available since 3.2.0 .
2424 * Time complexity: O(log(N)) for each item added, where N is the number of elements in the sorted set.
2525 * @link http://redis.io/commands/geoadd
2626 *
27+ *
2728 * @param string $key
2829 * @param array $members [member => [longitude, latitude]]
2930 * @return int The number of elements added to the sorted set,
@@ -41,7 +42,7 @@ public function geoadd($key, array $members) {
4142
4243 /**
4344 * GEODIST key member1 member2 [unit]
44- * Beta Not yet available in a stable version of Redis. Download unstable if you want to test this command .
45+ * Available since 3.2.0 .
4546 * Time complexity: O(log(N))
4647 * @link http://redis.io/commands/geodist
4748 *
@@ -62,7 +63,7 @@ public function geodist($key, $member1, $member2, $unit = null) {
6263
6364 /**
6465 * GEOHASH key member [member ...]
65- * Beta Not yet available in a stable version of Redis. Download unstable if you want to test this command .
66+ * Available since 3.2.0 .
6667 * Time complexity: O(log(N)) for each member requested, where N is the number of elements in the sorted set.
6768 * @link http://redis.io/commands/geohash
6869 *
@@ -77,7 +78,7 @@ public function geohash($key, $members) {
7778
7879 /**
7980 * GEOPOS key member [member ...]
80- * Beta Not yet available in a stable version of Redis. Download unstable if you want to test this command .
81+ * Available since 3.2.0 .
8182 * Time complexity: O(log(N)) for each member requested, where N is the number of elements in the sorted set.
8283 * @link http://redis.io/commands/geopos
8384 *
@@ -92,8 +93,8 @@ public function geopos($key, $members) {
9293 }
9394
9495 /**
95- * GEORADIUS key longitude latitude radius m|km|ft|mi [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count]
96- * Beta Not yet available in a stable version of Redis. Download unstable if you want to test this command .
96+ * GEORADIUS key longitude latitude radius m|km|ft|mi [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count] [ASC|DESC] [STORE|STOREDIST key]
97+ * Available since 3.2.0 .
9798 * Time complexity: O(N+log(M)) where N is the number of elements inside the bounding box of
9899 * the circular area delimited by center and radius and M is the number of items inside the index.
99100 * @link http://redis.io/commands/georadius
@@ -108,9 +109,14 @@ public function geopos($key, $members) {
108109 * @param bool|false $withhash
109110 * @param int|null $count
110111 * @param bool|null $asc (true => ASC, false => DESC)
111- * @return array
112+ * @param string|null $storeKey
113+ * @param bool $storeDist
114+ * @return array|int
112115 */
113- public function georadius ($ key , $ longitude , $ latitude , $ radius , $ unit , $ withcoord = false , $ withdist = false , $ withhash = false , $ count = null , $ asc = null ) {
116+ public function georadius (
117+ $ key , $ longitude , $ latitude , $ radius , $ unit , $ withcoord = false , $ withdist = false ,
118+ $ withhash = false , $ count = null , $ asc = null , $ storeKey = null , $ storeDist = false
119+ ) {
114120 $ params = [$ key , $ longitude , $ latitude , $ radius , $ unit ];
115121 $ parse = false ;
116122 if ($ withcoord ) {
@@ -132,12 +138,17 @@ public function georadius($key, $longitude, $latitude, $radius, $unit, $withcoor
132138 if (isset ($ asc )) {
133139 $ params [] = $ asc ? 'ASC ' : 'DESC ' ;
134140 }
141+ if (isset ($ storeKey )) {
142+ $ params [] = $ storeDist ? 'STOREDIST ' : 'STORE ' ;
143+ $ params [] = $ storeKey ;
144+ $ parse = false ;
145+ }
135146 return $ this ->returnCommand (['GEORADIUS ' ], $ params , $ parse ? ResponseParser::PARSE_GEO_ARRAY : null );
136147 }
137148
138149 /**
139- * GEORADIUSBYMEMBER key member radius m|km|ft|mi [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count]
140- * Beta Not yet available in a stable version of Redis. Download unstable if you want to test this command .
150+ * GEORADIUSBYMEMBER key member radius m|km|ft|mi [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count] [ASC|DESC] [STORE|STOREDIST key]
151+ * Available since 3.2.0 .
141152 * Time complexity: O(N+log(M)) where N is the number of elements inside the bounding box of
142153 * the circular area delimited by center and radius and M is the number of items inside the index.
143154 * @link http://redis.io/commands/georadiusbymember
@@ -151,9 +162,14 @@ public function georadius($key, $longitude, $latitude, $radius, $unit, $withcoor
151162 * @param bool|false $withhash
152163 * @param int|null $count
153164 * @param bool|null $asc (true => ASC, false => DESC)
154- * @return array
165+ * @param string|null $storeKey
166+ * @param bool $storeDist
167+ * @return array|int
155168 */
156- public function georadiusbymember ($ key , $ member , $ radius , $ unit , $ withcoord = false , $ withdist = false , $ withhash = false , $ count = null , $ asc = null ) {
169+ public function georadiusbymember (
170+ $ key , $ member , $ radius , $ unit , $ withcoord = false , $ withdist = false , $ withhash = false ,
171+ $ count = null , $ asc = null , $ storeKey = null , $ storeDist = false
172+ ) {
157173 $ params = [$ key , $ member , $ radius , $ unit ];
158174 $ parse = false ;
159175 if ($ withcoord ) {
@@ -175,6 +191,11 @@ public function georadiusbymember($key, $member, $radius, $unit, $withcoord = fa
175191 if (isset ($ asc )) {
176192 $ params [] = $ asc ? 'ASC ' : 'DESC ' ;
177193 }
194+ if (isset ($ storeKey )) {
195+ $ params [] = $ storeDist ? 'STOREDIST ' : 'STORE ' ;
196+ $ params [] = $ storeKey ;
197+ $ parse = false ;
198+ }
178199 return $ this ->returnCommand (['GEORADIUSBYMEMBER ' ], $ params , $ parse ? ResponseParser::PARSE_GEO_ARRAY : null );
179200 }
180201
0 commit comments