@@ -20,10 +20,11 @@ trait GeoCommandsTrait {
20
20
21
21
/**
22
22
* 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 .
24
24
* Time complexity: O(log(N)) for each item added, where N is the number of elements in the sorted set.
25
25
* @link http://redis.io/commands/geoadd
26
26
*
27
+ *
27
28
* @param string $key
28
29
* @param array $members [member => [longitude, latitude]]
29
30
* @return int The number of elements added to the sorted set,
@@ -41,7 +42,7 @@ public function geoadd($key, array $members) {
41
42
42
43
/**
43
44
* 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 .
45
46
* Time complexity: O(log(N))
46
47
* @link http://redis.io/commands/geodist
47
48
*
@@ -62,7 +63,7 @@ public function geodist($key, $member1, $member2, $unit = null) {
62
63
63
64
/**
64
65
* 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 .
66
67
* Time complexity: O(log(N)) for each member requested, where N is the number of elements in the sorted set.
67
68
* @link http://redis.io/commands/geohash
68
69
*
@@ -77,7 +78,7 @@ public function geohash($key, $members) {
77
78
78
79
/**
79
80
* 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 .
81
82
* Time complexity: O(log(N)) for each member requested, where N is the number of elements in the sorted set.
82
83
* @link http://redis.io/commands/geopos
83
84
*
@@ -92,8 +93,8 @@ public function geopos($key, $members) {
92
93
}
93
94
94
95
/**
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 .
97
98
* Time complexity: O(N+log(M)) where N is the number of elements inside the bounding box of
98
99
* the circular area delimited by center and radius and M is the number of items inside the index.
99
100
* @link http://redis.io/commands/georadius
@@ -108,9 +109,14 @@ public function geopos($key, $members) {
108
109
* @param bool|false $withhash
109
110
* @param int|null $count
110
111
* @param bool|null $asc (true => ASC, false => DESC)
111
- * @return array
112
+ * @param string|null $storeKey
113
+ * @param bool $storeDist
114
+ * @return array|int
112
115
*/
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
+ ) {
114
120
$ params = [$ key , $ longitude , $ latitude , $ radius , $ unit ];
115
121
$ parse = false ;
116
122
if ($ withcoord ) {
@@ -132,12 +138,17 @@ public function georadius($key, $longitude, $latitude, $radius, $unit, $withcoor
132
138
if (isset ($ asc )) {
133
139
$ params [] = $ asc ? 'ASC ' : 'DESC ' ;
134
140
}
141
+ if (isset ($ storeKey )) {
142
+ $ params [] = $ storeDist ? 'STOREDIST ' : 'STORE ' ;
143
+ $ params [] = $ storeKey ;
144
+ $ parse = false ;
145
+ }
135
146
return $ this ->returnCommand (['GEORADIUS ' ], $ params , $ parse ? ResponseParser::PARSE_GEO_ARRAY : null );
136
147
}
137
148
138
149
/**
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 .
141
152
* Time complexity: O(N+log(M)) where N is the number of elements inside the bounding box of
142
153
* the circular area delimited by center and radius and M is the number of items inside the index.
143
154
* @link http://redis.io/commands/georadiusbymember
@@ -151,9 +162,14 @@ public function georadius($key, $longitude, $latitude, $radius, $unit, $withcoor
151
162
* @param bool|false $withhash
152
163
* @param int|null $count
153
164
* @param bool|null $asc (true => ASC, false => DESC)
154
- * @return array
165
+ * @param string|null $storeKey
166
+ * @param bool $storeDist
167
+ * @return array|int
155
168
*/
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
+ ) {
157
173
$ params = [$ key , $ member , $ radius , $ unit ];
158
174
$ parse = false ;
159
175
if ($ withcoord ) {
@@ -175,6 +191,11 @@ public function georadiusbymember($key, $member, $radius, $unit, $withcoord = fa
175
191
if (isset ($ asc )) {
176
192
$ params [] = $ asc ? 'ASC ' : 'DESC ' ;
177
193
}
194
+ if (isset ($ storeKey )) {
195
+ $ params [] = $ storeDist ? 'STOREDIST ' : 'STORE ' ;
196
+ $ params [] = $ storeKey ;
197
+ $ parse = false ;
198
+ }
178
199
return $ this ->returnCommand (['GEORADIUSBYMEMBER ' ], $ params , $ parse ? ResponseParser::PARSE_GEO_ARRAY : null );
179
200
}
180
201
0 commit comments