Feature - radiusStoreSortedTo methods added to RGeo, RGeoAsync, RGeoRx, RGeoReactive interfaces. #2113

pull/2160/head
Nikita Koksharov 6 years ago
parent e150e5dcbc
commit 68286c2683

@ -512,4 +512,79 @@ public class RedissonGeo<V> extends RedissonScoredSortedSet<V> implements RGeo<V
encode(member), radius, geoUnit, geoOrder, "COUNT", count, "STORE", destName); encode(member), radius, geoUnit, geoOrder, "COUNT", count, "STORE", destName);
} }
@Override
public RFuture<Long> radiusStoreSortedToAsync(String destName, double longitude, double latitude, double radius,
GeoUnit geoUnit) {
return commandExecutor.writeAsync(getName(), LongCodec.INSTANCE, RedisCommands.GEORADIUS_STORE, getName(),
convert(longitude), convert(latitude), radius, geoUnit, "STOREDIST", destName);
}
@Override
public RFuture<Long> radiusStoreSortedToAsync(String destName, double longitude, double latitude, double radius,
GeoUnit geoUnit, int count) {
return commandExecutor.writeAsync(getName(), LongCodec.INSTANCE, RedisCommands.GEORADIUS_STORE, getName(),
convert(longitude), convert(latitude), radius, geoUnit, "COUNT", count, "STOREDIST", destName);
}
@Override
public RFuture<Long> radiusStoreSortedToAsync(String destName, double longitude, double latitude, double radius,
GeoUnit geoUnit, GeoOrder geoOrder, int count) {
return commandExecutor.writeAsync(getName(), LongCodec.INSTANCE, RedisCommands.GEORADIUS_STORE, getName(),
convert(longitude), convert(latitude), radius, geoUnit, geoOrder, "COUNT", count, "STOREDIST", destName);
}
@Override
public RFuture<Long> radiusStoreSortedToAsync(String destName, V member, double radius, GeoUnit geoUnit) {
return commandExecutor.writeAsync(getName(), codec, RedisCommands.GEORADIUSBYMEMBER_STORE, getName(),
encode(member), radius, geoUnit, "STOREDIST", destName);
}
@Override
public RFuture<Long> radiusStoreSortedToAsync(String destName, V member, double radius, GeoUnit geoUnit,
int count) {
return commandExecutor.writeAsync(getName(), codec, RedisCommands.GEORADIUSBYMEMBER_STORE, getName(),
encode(member), radius, geoUnit, "COUNT", count, "STOREDIST", destName);
}
@Override
public RFuture<Long> radiusStoreSortedToAsync(String destName, V member, double radius, GeoUnit geoUnit,
GeoOrder geoOrder, int count) {
return commandExecutor.writeAsync(getName(), codec, RedisCommands.GEORADIUSBYMEMBER_STORE, getName(),
encode(member), radius, geoUnit, geoOrder, "COUNT", count, "STOREDIST", destName);
}
@Override
public long radiusStoreSortedTo(String destName, double longitude, double latitude, double radius,
GeoUnit geoUnit) {
return get(radiusStoreSortedToAsync(destName, longitude, latitude, radius, geoUnit));
}
@Override
public long radiusStoreSortedTo(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit,
int count) {
return get(radiusStoreSortedToAsync(destName, longitude, latitude, radius, geoUnit, count));
}
@Override
public long radiusStoreSortedTo(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit,
GeoOrder geoOrder, int count) {
return get(radiusStoreSortedToAsync(destName, longitude, latitude, radius, geoUnit, geoOrder, count));
}
@Override
public long radiusStoreSortedTo(String destName, V member, double radius, GeoUnit geoUnit) {
return get(radiusStoreSortedToAsync(destName, member, radius, geoUnit));
}
@Override
public long radiusStoreSortedTo(String destName, V member, double radius, GeoUnit geoUnit, int count) {
return get(radiusStoreSortedToAsync(destName, member, radius, geoUnit));
}
@Override
public long radiusStoreSortedTo(String destName, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder,
int count) {
return get(radiusStoreSortedToAsync(destName, member, radius, geoUnit));
}
} }

@ -498,7 +498,8 @@ public interface RGeo<V> extends RScoredSortedSet<V>, RGeoAsync<V> {
* borders of the area specified with the center location * borders of the area specified with the center location
* and the maximum distance from the center (the radius) * and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units. * in <code>GeoUnit</code> units.
* Store result to <code>destName</code>. * <p>
* Stores result to <code>destName</code>.
* *
* @param destName - Geo object destination * @param destName - Geo object destination
* @param longitude - longitude of object * @param longitude - longitude of object
@ -514,7 +515,8 @@ public interface RGeo<V> extends RScoredSortedSet<V>, RGeoAsync<V> {
* borders of the area specified with the center location * borders of the area specified with the center location
* and the maximum distance from the center (the radius) * and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units and limited by count * in <code>GeoUnit</code> units and limited by count
* Store result to <code>destName</code>. * <p>
* Stores result to <code>destName</code>.
* *
* @param destName - Geo object destination * @param destName - Geo object destination
* @param longitude - longitude of object * @param longitude - longitude of object
@ -532,7 +534,8 @@ public interface RGeo<V> extends RScoredSortedSet<V>, RGeoAsync<V> {
* and the maximum distance from the center (the radius) * and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units with <code>GeoOrder</code> * in <code>GeoUnit</code> units with <code>GeoOrder</code>
* and limited by count * and limited by count
* Store result to <code>destName</code>. * <p>
* Stores result to <code>destName</code>.
* *
* @param destName - Geo object destination * @param destName - Geo object destination
* @param longitude - longitude of object * @param longitude - longitude of object
@ -550,7 +553,8 @@ public interface RGeo<V> extends RScoredSortedSet<V>, RGeoAsync<V> {
* borders of the area specified with the defined member location * borders of the area specified with the defined member location
* and the maximum distance from the defined member location (the radius) * and the maximum distance from the defined member location (the radius)
* in <code>GeoUnit</code> units. * in <code>GeoUnit</code> units.
* Store result to <code>destName</code>. * <p>
* Stores result to <code>destName</code>.
* *
* @param destName - Geo object destination * @param destName - Geo object destination
* @param member - object * @param member - object
@ -565,7 +569,8 @@ public interface RGeo<V> extends RScoredSortedSet<V>, RGeoAsync<V> {
* borders of the area specified with the defined member location * borders of the area specified with the defined member location
* and the maximum distance from the defined member location (the radius) * and the maximum distance from the defined member location (the radius)
* in <code>GeoUnit</code> units and limited by count * in <code>GeoUnit</code> units and limited by count
* Store result to <code>destName</code>. * <p>
* Stores result to <code>destName</code>.
* *
* @param destName - Geo object destination * @param destName - Geo object destination
* @param member - object * @param member - object
@ -581,7 +586,8 @@ public interface RGeo<V> extends RScoredSortedSet<V>, RGeoAsync<V> {
* borders of the area specified with the defined member location * borders of the area specified with the defined member location
* and the maximum distance from the defined member location (the radius) * and the maximum distance from the defined member location (the radius)
* in <code>GeoUnit</code> units with <code>GeoOrder</code> * in <code>GeoUnit</code> units with <code>GeoOrder</code>
* Store result to <code>destName</code>. * <p>
* Stores result to <code>destName</code>.
* *
* @param destName - Geo object destination * @param destName - Geo object destination
* @param member - object * @param member - object
@ -593,4 +599,111 @@ public interface RGeo<V> extends RScoredSortedSet<V>, RGeoAsync<V> {
*/ */
long radiusStoreTo(String destName, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count); long radiusStoreTo(String destName, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the center location
* and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units.
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param longitude - longitude of object
* @param latitude - latitude of object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @return length of result
*/
long radiusStoreSortedTo(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the center location
* and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units and limited by count.
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param longitude - longitude of object
* @param latitude - latitude of object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @param count - result limit
* @return length of result
*/
long radiusStoreSortedTo(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit, int count);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the center location
* and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
* and limited by count.
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param longitude - longitude of object
* @param latitude - latitude of object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @param geoOrder - order of result
* @param count - result limit
* @return length of result
*/
long radiusStoreSortedTo(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the defined member location
* and the maximum distance from the defined member location (the radius)
* in <code>GeoUnit</code> units.
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param member - object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @return length of result
*/
long radiusStoreSortedTo(String destName, V member, double radius, GeoUnit geoUnit);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the defined member location
* and the maximum distance from the defined member location (the radius)
* in <code>GeoUnit</code> units and limited by count.
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param member - object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @param count - result limit
* @return length of result
*/
long radiusStoreSortedTo(String destName, V member, double radius, GeoUnit geoUnit, int count);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the defined member location
* and the maximum distance from the defined member location (the radius)
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param member - object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @param geoOrder - geo order
* @param count - result limit
* @return length of result
*/
long radiusStoreSortedTo(String destName, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count);
} }

@ -497,7 +497,8 @@ public interface RGeoAsync<V> extends RScoredSortedSetAsync<V> {
* borders of the area specified with the center location * borders of the area specified with the center location
* and the maximum distance from the center (the radius) * and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units. * in <code>GeoUnit</code> units.
* Store result to <code>destName</code>. * <p>
* Stores result to <code>destName</code>.
* *
* @param destName - Geo object destination * @param destName - Geo object destination
* @param longitude - longitude of object * @param longitude - longitude of object
@ -513,7 +514,8 @@ public interface RGeoAsync<V> extends RScoredSortedSetAsync<V> {
* borders of the area specified with the center location * borders of the area specified with the center location
* and the maximum distance from the center (the radius) * and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units and limited by count * in <code>GeoUnit</code> units and limited by count
* Store result to <code>destName</code>. * <p>
* Stores result to <code>destName</code>.
* *
* @param destName - Geo object destination * @param destName - Geo object destination
* @param longitude - longitude of object * @param longitude - longitude of object
@ -530,8 +532,9 @@ public interface RGeoAsync<V> extends RScoredSortedSetAsync<V> {
* borders of the area specified with the center location * borders of the area specified with the center location
* and the maximum distance from the center (the radius) * and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units with <code>GeoOrder</code> * in <code>GeoUnit</code> units with <code>GeoOrder</code>
* and limited by count * and limited by count.
* Store result to <code>destName</code>. * <p>
* Stores result to <code>destName</code>.
* *
* @param destName - Geo object destination * @param destName - Geo object destination
* @param longitude - longitude of object * @param longitude - longitude of object
@ -549,7 +552,8 @@ public interface RGeoAsync<V> extends RScoredSortedSetAsync<V> {
* borders of the area specified with the defined member location * borders of the area specified with the defined member location
* and the maximum distance from the defined member location (the radius) * and the maximum distance from the defined member location (the radius)
* in <code>GeoUnit</code> units. * in <code>GeoUnit</code> units.
* Store result to <code>destName</code>. * <p>
* Stores result to <code>destName</code>.
* *
* @param destName - Geo object destination * @param destName - Geo object destination
* @param member - object * @param member - object
@ -563,8 +567,9 @@ public interface RGeoAsync<V> extends RScoredSortedSetAsync<V> {
* Finds the members of a sorted set, which are within the * Finds the members of a sorted set, which are within the
* borders of the area specified with the defined member location * borders of the area specified with the defined member location
* and the maximum distance from the defined member location (the radius) * and the maximum distance from the defined member location (the radius)
* in <code>GeoUnit</code> units and limited by count * in <code>GeoUnit</code> units and limited by count.
* Store result to <code>destName</code>. * <p>
* Stores result to <code>destName</code>.
* *
* @param destName - Geo object destination * @param destName - Geo object destination
* @param member - object * @param member - object
@ -580,7 +585,8 @@ public interface RGeoAsync<V> extends RScoredSortedSetAsync<V> {
* borders of the area specified with the defined member location * borders of the area specified with the defined member location
* and the maximum distance from the defined member location (the radius) * and the maximum distance from the defined member location (the radius)
* in <code>GeoUnit</code> units with <code>GeoOrder</code> * in <code>GeoUnit</code> units with <code>GeoOrder</code>
* Store result to <code>destName</code>. * <p>
* Stores result to <code>destName</code>.
* *
* @param destName - Geo object destination * @param destName - Geo object destination
* @param member - object * @param member - object
@ -592,4 +598,110 @@ public interface RGeoAsync<V> extends RScoredSortedSetAsync<V> {
*/ */
RFuture<Long> radiusStoreToAsync(String destName, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count); RFuture<Long> radiusStoreToAsync(String destName, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the center location
* and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units.
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param longitude - longitude of object
* @param latitude - latitude of object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @return length of result
*/
RFuture<Long> radiusStoreSortedToAsync(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the center location
* and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units and limited by count
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param longitude - longitude of object
* @param latitude - latitude of object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @param count - result limit
* @return length of result
*/
RFuture<Long> radiusStoreSortedToAsync(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit, int count);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the center location
* and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
* and limited by count.
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param longitude - longitude of object
* @param latitude - latitude of object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @param geoOrder - order of result
* @param count - result limit
* @return length of result
*/
RFuture<Long> radiusStoreSortedToAsync(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the defined member location
* and the maximum distance from the defined member location (the radius)
* in <code>GeoUnit</code> units.
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param member - object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @return length of result
*/
RFuture<Long> radiusStoreSortedToAsync(String destName, V member, double radius, GeoUnit geoUnit);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the defined member location
* and the maximum distance from the defined member location (the radius)
* in <code>GeoUnit</code> units and limited by count.
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param member - object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @param count - result limit
* @return length of result
*/
RFuture<Long> radiusStoreSortedToAsync(String destName, V member, double radius, GeoUnit geoUnit, int count);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the defined member location
* and the maximum distance from the defined member location (the radius)
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param member - object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @param geoOrder - geo order
* @param count - result limit
* @return length of result
*/
RFuture<Long> radiusStoreSortedToAsync(String destName, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count);
} }

@ -594,4 +594,111 @@ public interface RGeoReactive<V> extends RScoredSortedSetReactive<V> {
*/ */
Mono<Long> radiusStoreTo(String destName, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count); Mono<Long> radiusStoreTo(String destName, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the center location
* and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units.
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param longitude - longitude of object
* @param latitude - latitude of object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @return length of result
*/
Mono<Long> radiusStoreSortedTo(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the center location
* and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units and limited by count
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param longitude - longitude of object
* @param latitude - latitude of object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @param count - result limit
* @return length of result
*/
Mono<Long> radiusStoreSortedTo(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit, int count);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the center location
* and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
* and limited by count.
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param longitude - longitude of object
* @param latitude - latitude of object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @param geoOrder - order of result
* @param count - result limit
* @return length of result
*/
Mono<Long> radiusStoreSortedTo(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the defined member location
* and the maximum distance from the defined member location (the radius)
* in <code>GeoUnit</code> units.
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param member - object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @return length of result
*/
Mono<Long> radiusStoreSortedTo(String destName, V member, double radius, GeoUnit geoUnit);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the defined member location
* and the maximum distance from the defined member location (the radius)
* in <code>GeoUnit</code> units and limited by count.
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param member - object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @param count - result limit
* @return length of result
*/
Mono<Long> radiusStoreSortedTo(String destName, V member, double radius, GeoUnit geoUnit, int count);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the defined member location
* and the maximum distance from the defined member location (the radius)
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param member - object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @param geoOrder - geo order
* @param count - result limit
* @return length of result
*/
Mono<Long> radiusStoreSortedTo(String destName, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count);
} }

@ -499,7 +499,8 @@ public interface RGeoRx<V> extends RScoredSortedSetRx<V> {
* borders of the area specified with the center location * borders of the area specified with the center location
* and the maximum distance from the center (the radius) * and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units. * in <code>GeoUnit</code> units.
* Store result to <code>destName</code>. * <p>
* Stores result to <code>destName</code> sorted by distance.
* *
* @param destName - Geo object destination * @param destName - Geo object destination
* @param longitude - longitude of object * @param longitude - longitude of object
@ -514,8 +515,9 @@ public interface RGeoRx<V> extends RScoredSortedSetRx<V> {
* Finds the members of a sorted set, which are within the * Finds the members of a sorted set, which are within the
* borders of the area specified with the center location * borders of the area specified with the center location
* and the maximum distance from the center (the radius) * and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units and limited by count * in <code>GeoUnit</code> units and limited by count.
* Store result to <code>destName</code>. * <p>
* Store result to <code>destName</code> sorted by distance.
* *
* @param destName - Geo object destination * @param destName - Geo object destination
* @param longitude - longitude of object * @param longitude - longitude of object
@ -532,8 +534,9 @@ public interface RGeoRx<V> extends RScoredSortedSetRx<V> {
* borders of the area specified with the center location * borders of the area specified with the center location
* and the maximum distance from the center (the radius) * and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units with <code>GeoOrder</code> * in <code>GeoUnit</code> units with <code>GeoOrder</code>
* and limited by count * and limited by count.
* Store result to <code>destName</code>. * <p>
* Stores result to <code>destName</code> sorted by distance.
* *
* @param destName - Geo object destination * @param destName - Geo object destination
* @param longitude - longitude of object * @param longitude - longitude of object
@ -551,7 +554,8 @@ public interface RGeoRx<V> extends RScoredSortedSetRx<V> {
* borders of the area specified with the defined member location * borders of the area specified with the defined member location
* and the maximum distance from the defined member location (the radius) * and the maximum distance from the defined member location (the radius)
* in <code>GeoUnit</code> units. * in <code>GeoUnit</code> units.
* Store result to <code>destName</code>. * <p>
* Store result to <code>destName</code> sorted by distance.
* *
* @param destName - Geo object destination * @param destName - Geo object destination
* @param member - object * @param member - object
@ -565,8 +569,9 @@ public interface RGeoRx<V> extends RScoredSortedSetRx<V> {
* Finds the members of a sorted set, which are within the * Finds the members of a sorted set, which are within the
* borders of the area specified with the defined member location * borders of the area specified with the defined member location
* and the maximum distance from the defined member location (the radius) * and the maximum distance from the defined member location (the radius)
* in <code>GeoUnit</code> units and limited by count * in <code>GeoUnit</code> units and limited by count.
* Store result to <code>destName</code>. * <p>
* Store result to <code>destName</code> sorted by distance.
* *
* @param destName - Geo object destination * @param destName - Geo object destination
* @param member - object * @param member - object
@ -581,8 +586,9 @@ public interface RGeoRx<V> extends RScoredSortedSetRx<V> {
* Finds the members of a sorted set, which are within the * Finds the members of a sorted set, which are within the
* borders of the area specified with the defined member location * borders of the area specified with the defined member location
* and the maximum distance from the defined member location (the radius) * and the maximum distance from the defined member location (the radius)
* in <code>GeoUnit</code> units with <code>GeoOrder</code> * in <code>GeoUnit</code> units with <code>GeoOrder</code>.
* Store result to <code>destName</code>. * <p>
* Store result to <code>destName</code> sorted by distance.
* *
* @param destName - Geo object destination * @param destName - Geo object destination
* @param member - object * @param member - object
@ -594,4 +600,111 @@ public interface RGeoRx<V> extends RScoredSortedSetRx<V> {
*/ */
Single<Long> radiusStoreTo(String destName, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count); Single<Long> radiusStoreTo(String destName, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the center location
* and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units.
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param longitude - longitude of object
* @param latitude - latitude of object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @return length of result
*/
Single<Long> radiusStoreSortedTo(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the center location
* and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units and limited by count
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param longitude - longitude of object
* @param latitude - latitude of object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @param count - result limit
* @return length of result
*/
Single<Long> radiusStoreSortedTo(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit, int count);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the center location
* and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
* and limited by count.
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param longitude - longitude of object
* @param latitude - latitude of object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @param geoOrder - order of result
* @param count - result limit
* @return length of result
*/
Single<Long> radiusStoreSortedTo(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the defined member location
* and the maximum distance from the defined member location (the radius)
* in <code>GeoUnit</code> units.
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param member - object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @return length of result
*/
Single<Long> radiusStoreSortedTo(String destName, V member, double radius, GeoUnit geoUnit);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the defined member location
* and the maximum distance from the defined member location (the radius)
* in <code>GeoUnit</code> units and limited by count.
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param member - object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @param count - result limit
* @return length of result
*/
Single<Long> radiusStoreSortedTo(String destName, V member, double radius, GeoUnit geoUnit, int count);
/**
* Finds the members of a sorted set, which are within the
* borders of the area specified with the defined member location
* and the maximum distance from the defined member location (the radius)
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
* <p>
* Stores result to <code>destName</code> sorted by distance.
*
* @param destName - Geo object destination
* @param member - object
* @param radius - radius in geo units
* @param geoUnit - geo unit
* @param geoOrder - geo order
* @param count - result limit
* @return length of result
*/
Single<Long> radiusStoreSortedTo(String destName, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count);
} }

@ -524,6 +524,16 @@ public class RedissonGeoTest extends BaseTest {
assertThat(geoDest.readAll()).containsExactlyInAnyOrder("Palermo", "Catania"); assertThat(geoDest.readAll()).containsExactlyInAnyOrder("Palermo", "Catania");
} }
@Test
public void testRadiusStoreSorted() {
RGeo<String> geoSource = redisson.getGeo("test");
RGeo<String> geoDest = redisson.getGeo("test-store");
geoSource.add(new GeoEntry(13.361389, 38.115556, "Palermo"), new GeoEntry(15.087269, 37.502669, "Catania"));
assertThat(geoSource.radiusStoreSortedTo(geoDest.getName(), 15, 37, 200, GeoUnit.KILOMETERS)).isEqualTo(2);
assertThat(geoDest.readAll()).containsExactly("Catania", "Palermo");
}
@Test @Test
public void testRadiusStoreCount() { public void testRadiusStoreCount() {
RGeo<String> geoSource = redisson.getGeo("test"); RGeo<String> geoSource = redisson.getGeo("test");
@ -534,6 +544,16 @@ public class RedissonGeoTest extends BaseTest {
assertThat(geoDest.readAll()).containsExactly("Catania"); assertThat(geoDest.readAll()).containsExactly("Catania");
} }
@Test
public void testRadiusStoreSortedCount() {
RGeo<String> geoSource = redisson.getGeo("test");
RGeo<String> geoDest = redisson.getGeo("test-store");
geoSource.add(new GeoEntry(13.361389, 38.115556, "Palermo"), new GeoEntry(15.087269, 37.502669, "Catania"));
assertThat(geoSource.radiusStoreSortedTo(geoDest.getName(), 15, 37, 200, GeoUnit.KILOMETERS, 1)).isEqualTo(1);
assertThat(geoDest.readAll()).containsExactly("Catania");
}
@Test @Test
public void testRadiusStoreOrderCount() { public void testRadiusStoreOrderCount() {
RGeo<String> geoSource = redisson.getGeo("test"); RGeo<String> geoSource = redisson.getGeo("test");
@ -547,6 +567,19 @@ public class RedissonGeoTest extends BaseTest {
assertThat(geoDest.readAll()).containsExactly("Catania"); assertThat(geoDest.readAll()).containsExactly("Catania");
} }
@Test
public void testRadiusStoreSortedOrderCount() {
RGeo<String> geoSource = redisson.getGeo("test");
RGeo<String> geoDest = redisson.getGeo("test-store");
geoSource.add(new GeoEntry(13.361389, 38.115556, "Palermo"), new GeoEntry(15.087269, 37.502669, "Catania"));
assertThat(geoSource.radiusStoreSortedTo(geoDest.getName(), 15, 37, 200, GeoUnit.KILOMETERS, GeoOrder.DESC, 1)).isEqualTo(1);
assertThat(geoDest.readAll()).containsExactly("Palermo");
assertThat(geoSource.radiusStoreSortedTo(geoDest.getName(), 15, 37, 200, GeoUnit.KILOMETERS, GeoOrder.ASC, 1)).isEqualTo(1);
assertThat(geoDest.readAll()).containsExactly("Catania");
}
@Test @Test
public void testRadiusStoreEmpty() { public void testRadiusStoreEmpty() {
RGeo<String> geoSource = redisson.getGeo("test"); RGeo<String> geoSource = redisson.getGeo("test");

Loading…
Cancel
Save