diff --git a/redisson/src/main/java/org/redisson/RedissonGeo.java b/redisson/src/main/java/org/redisson/RedissonGeo.java index 0edb23f5a..30385eeca 100644 --- a/redisson/src/main/java/org/redisson/RedissonGeo.java +++ b/redisson/src/main/java/org/redisson/RedissonGeo.java @@ -512,4 +512,79 @@ public class RedissonGeo extends RedissonScoredSortedSet implements RGeo 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 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 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 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 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 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)); + } + } diff --git a/redisson/src/main/java/org/redisson/api/RGeo.java b/redisson/src/main/java/org/redisson/api/RGeo.java index 90c7b634d..6b21e7df1 100644 --- a/redisson/src/main/java/org/redisson/api/RGeo.java +++ b/redisson/src/main/java/org/redisson/api/RGeo.java @@ -497,8 +497,9 @@ public interface RGeo extends RScoredSortedSet, RGeoAsync { * 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 GeoUnit units. - * Store result to destName. + * in GeoUnit units. + *

+ * Stores result to destName. * * @param destName - Geo object destination * @param longitude - longitude of object @@ -513,8 +514,9 @@ public interface RGeo extends RScoredSortedSet, RGeoAsync { * 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 GeoUnit units and limited by count - * Store result to destName. + * in GeoUnit units and limited by count + *

+ * Stores result to destName. * * @param destName - Geo object destination * @param longitude - longitude of object @@ -531,8 +533,9 @@ public interface RGeo extends RScoredSortedSet, RGeoAsync { * borders of the area specified with the center location * and the maximum distance from the center (the radius) * in GeoUnit units with GeoOrder - * and limited by count - * Store result to destName. + * and limited by count + *

+ * Stores result to destName. * * @param destName - Geo object destination * @param longitude - longitude of object @@ -549,8 +552,9 @@ public interface RGeo extends RScoredSortedSet, RGeoAsync { * 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 GeoUnit units. - * Store result to destName. + * in GeoUnit units. + *

+ * Stores result to destName. * * @param destName - Geo object destination * @param member - object @@ -565,7 +569,8 @@ public interface RGeo extends RScoredSortedSet, RGeoAsync { * borders of the area specified with the defined member location * and the maximum distance from the defined member location (the radius) * in GeoUnit units and limited by count - * Store result to destName. + *

+ * Stores result to destName. * * @param destName - Geo object destination * @param member - object @@ -580,8 +585,9 @@ public interface RGeo extends RScoredSortedSet, RGeoAsync { * 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 GeoUnit units with GeoOrder - * Store result to destName. + * in GeoUnit units with GeoOrder + *

+ * Stores result to destName. * * @param destName - Geo object destination * @param member - object @@ -593,4 +599,111 @@ public interface RGeo extends RScoredSortedSet, RGeoAsync { */ 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 GeoUnit units. + *

+ * Stores result to destName 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 GeoUnit units and limited by count. + *

+ * Stores result to destName 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 GeoUnit units with GeoOrder + * and limited by count. + *

+ * Stores result to destName 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 GeoUnit units. + *

+ * Stores result to destName 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 GeoUnit units and limited by count. + *

+ * Stores result to destName 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 GeoUnit units with GeoOrder + *

+ * Stores result to destName 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); + + } diff --git a/redisson/src/main/java/org/redisson/api/RGeoAsync.java b/redisson/src/main/java/org/redisson/api/RGeoAsync.java index cf6d931bf..a253c279a 100644 --- a/redisson/src/main/java/org/redisson/api/RGeoAsync.java +++ b/redisson/src/main/java/org/redisson/api/RGeoAsync.java @@ -496,8 +496,9 @@ public interface RGeoAsync extends RScoredSortedSetAsync { * 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 GeoUnit units. - * Store result to destName. + * in GeoUnit units. + *

+ * Stores result to destName. * * @param destName - Geo object destination * @param longitude - longitude of object @@ -512,8 +513,9 @@ public interface RGeoAsync extends RScoredSortedSetAsync { * 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 GeoUnit units and limited by count - * Store result to destName. + * in GeoUnit units and limited by count + *

+ * Stores result to destName. * * @param destName - Geo object destination * @param longitude - longitude of object @@ -530,8 +532,9 @@ public interface RGeoAsync extends RScoredSortedSetAsync { * borders of the area specified with the center location * and the maximum distance from the center (the radius) * in GeoUnit units with GeoOrder - * and limited by count - * Store result to destName. + * and limited by count. + *

+ * Stores result to destName. * * @param destName - Geo object destination * @param longitude - longitude of object @@ -548,8 +551,9 @@ public interface RGeoAsync extends RScoredSortedSetAsync { * 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 GeoUnit units. - * Store result to destName. + * in GeoUnit units. + *

+ * Stores result to destName. * * @param destName - Geo object destination * @param member - object @@ -563,8 +567,9 @@ public interface RGeoAsync extends RScoredSortedSetAsync { * 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 GeoUnit units and limited by count - * Store result to destName. + * in GeoUnit units and limited by count. + *

+ * Stores result to destName. * * @param destName - Geo object destination * @param member - object @@ -579,8 +584,9 @@ public interface RGeoAsync extends RScoredSortedSetAsync { * 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 GeoUnit units with GeoOrder - * Store result to destName. + * in GeoUnit units with GeoOrder + *

+ * Stores result to destName. * * @param destName - Geo object destination * @param member - object @@ -592,4 +598,110 @@ public interface RGeoAsync extends RScoredSortedSetAsync { */ RFuture 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 GeoUnit units. + *

+ * Stores result to destName 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 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 GeoUnit units and limited by count + *

+ * Stores result to destName 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 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 GeoUnit units with GeoOrder + * and limited by count. + *

+ * Stores result to destName 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 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 GeoUnit units. + *

+ * Stores result to destName 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 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 GeoUnit units and limited by count. + *

+ * Stores result to destName 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 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 GeoUnit units with GeoOrder + *

+ * Stores result to destName 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 radiusStoreSortedToAsync(String destName, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count); + } diff --git a/redisson/src/main/java/org/redisson/api/RGeoReactive.java b/redisson/src/main/java/org/redisson/api/RGeoReactive.java index 300586fbf..bbeb7756c 100644 --- a/redisson/src/main/java/org/redisson/api/RGeoReactive.java +++ b/redisson/src/main/java/org/redisson/api/RGeoReactive.java @@ -594,4 +594,111 @@ public interface RGeoReactive extends RScoredSortedSetReactive { */ Mono 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 GeoUnit units. + *

+ * Stores result to destName 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 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 GeoUnit units and limited by count + *

+ * Stores result to destName 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 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 GeoUnit units with GeoOrder + * and limited by count. + *

+ * Stores result to destName 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 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 GeoUnit units. + *

+ * Stores result to destName 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 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 GeoUnit units and limited by count. + *

+ * Stores result to destName 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 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 GeoUnit units with GeoOrder + *

+ * Stores result to destName 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 radiusStoreSortedTo(String destName, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count); + + } diff --git a/redisson/src/main/java/org/redisson/api/RGeoRx.java b/redisson/src/main/java/org/redisson/api/RGeoRx.java index d109287bc..3c9fc2c69 100644 --- a/redisson/src/main/java/org/redisson/api/RGeoRx.java +++ b/redisson/src/main/java/org/redisson/api/RGeoRx.java @@ -499,7 +499,8 @@ public interface RGeoRx extends RScoredSortedSetRx { * borders of the area specified with the center location * and the maximum distance from the center (the radius) * in GeoUnit units. - * Store result to destName. + *

+ * Stores result to destName sorted by distance. * * @param destName - Geo object destination * @param longitude - longitude of object @@ -514,8 +515,9 @@ public interface RGeoRx extends RScoredSortedSetRx { * 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 GeoUnit units and limited by count - * Store result to destName. + * in GeoUnit units and limited by count. + *

+ * Store result to destName sorted by distance. * * @param destName - Geo object destination * @param longitude - longitude of object @@ -532,8 +534,9 @@ public interface RGeoRx extends RScoredSortedSetRx { * borders of the area specified with the center location * and the maximum distance from the center (the radius) * in GeoUnit units with GeoOrder - * and limited by count - * Store result to destName. + * and limited by count. + *

+ * Stores result to destName sorted by distance. * * @param destName - Geo object destination * @param longitude - longitude of object @@ -551,7 +554,8 @@ public interface RGeoRx extends RScoredSortedSetRx { * borders of the area specified with the defined member location * and the maximum distance from the defined member location (the radius) * in GeoUnit units. - * Store result to destName. + *

+ * Store result to destName sorted by distance. * * @param destName - Geo object destination * @param member - object @@ -565,8 +569,9 @@ public interface RGeoRx extends RScoredSortedSetRx { * 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 GeoUnit units and limited by count - * Store result to destName. + * in GeoUnit units and limited by count. + *

+ * Store result to destName sorted by distance. * * @param destName - Geo object destination * @param member - object @@ -581,8 +586,9 @@ public interface RGeoRx extends RScoredSortedSetRx { * 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 GeoUnit units with GeoOrder - * Store result to destName. + * in GeoUnit units with GeoOrder. + *

+ * Store result to destName sorted by distance. * * @param destName - Geo object destination * @param member - object @@ -594,4 +600,111 @@ public interface RGeoRx extends RScoredSortedSetRx { */ Single 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 GeoUnit units. + *

+ * Stores result to destName 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 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 GeoUnit units and limited by count + *

+ * Stores result to destName 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 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 GeoUnit units with GeoOrder + * and limited by count. + *

+ * Stores result to destName 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 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 GeoUnit units. + *

+ * Stores result to destName 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 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 GeoUnit units and limited by count. + *

+ * Stores result to destName 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 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 GeoUnit units with GeoOrder + *

+ * Stores result to destName 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 radiusStoreSortedTo(String destName, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count); + + } diff --git a/redisson/src/test/java/org/redisson/RedissonGeoTest.java b/redisson/src/test/java/org/redisson/RedissonGeoTest.java index fa2b2d5e2..abc58558d 100644 --- a/redisson/src/test/java/org/redisson/RedissonGeoTest.java +++ b/redisson/src/test/java/org/redisson/RedissonGeoTest.java @@ -524,6 +524,16 @@ public class RedissonGeoTest extends BaseTest { assertThat(geoDest.readAll()).containsExactlyInAnyOrder("Palermo", "Catania"); } + @Test + public void testRadiusStoreSorted() { + RGeo geoSource = redisson.getGeo("test"); + RGeo 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 public void testRadiusStoreCount() { RGeo geoSource = redisson.getGeo("test"); @@ -534,6 +544,16 @@ public class RedissonGeoTest extends BaseTest { assertThat(geoDest.readAll()).containsExactly("Catania"); } + @Test + public void testRadiusStoreSortedCount() { + RGeo geoSource = redisson.getGeo("test"); + RGeo 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 public void testRadiusStoreOrderCount() { RGeo geoSource = redisson.getGeo("test"); @@ -547,6 +567,19 @@ public class RedissonGeoTest extends BaseTest { assertThat(geoDest.readAll()).containsExactly("Catania"); } + @Test + public void testRadiusStoreSortedOrderCount() { + RGeo geoSource = redisson.getGeo("test"); + RGeo 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 public void testRadiusStoreEmpty() { RGeo geoSource = redisson.getGeo("test");