From df0d13598097989eb44bd20bac47dc713b6c26a0 Mon Sep 17 00:00:00 2001 From: Cory Sherman Date: Fri, 28 Apr 2017 09:21:53 -0700 Subject: [PATCH] change API "radiusStore()" -> "radiusStoreTo()" From @mrniko's feedback, to match RSortable API. Read from current Geo, store to destName. --- .../main/java/org/redisson/RedissonGeo.java | 48 +++++++++---------- .../src/main/java/org/redisson/api/RGeo.java | 36 +++++++------- .../main/java/org/redisson/api/RGeoAsync.java | 36 +++++++------- .../java/org/redisson/RedissonGeoTest.java | 20 ++++---- 4 files changed, 70 insertions(+), 70 deletions(-) diff --git a/redisson/src/main/java/org/redisson/RedissonGeo.java b/redisson/src/main/java/org/redisson/RedissonGeo.java index ae4c710eb..e7992e007 100644 --- a/redisson/src/main/java/org/redisson/RedissonGeo.java +++ b/redisson/src/main/java/org/redisson/RedissonGeo.java @@ -407,63 +407,63 @@ public class RedissonGeo extends RedissonScoredSortedSet implements RGeo radiusStoreAsync(String fromKey, double longitude, double latitude, double radius, GeoUnit geoUnit) { - return commandExecutor.writeAsync(getName(), LongCodec.INSTANCE, RedisCommands.GEORADIUS_STORE_INT, fromKey, convert(longitude), convert(latitude), radius, geoUnit, "STORE", getName()); + public RFuture radiusStoreToAsync(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit) { + return commandExecutor.writeAsync(getName(), LongCodec.INSTANCE, RedisCommands.GEORADIUS_STORE_INT, getName(), convert(longitude), convert(latitude), radius, geoUnit, "STORE", destName); } @Override - public int radiusStore(String fromKey, double longitude, double latitude, double radius, GeoUnit geoUnit, int count) { - return get(radiusStoreAsync(fromKey, longitude, latitude, radius, geoUnit, count)); + public int radiusStoreTo(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit, int count) { + return get(radiusStoreToAsync(destName, longitude, latitude, radius, geoUnit, count)); } @Override - public RFuture radiusStoreAsync(String fromKey, double longitude, double latitude, double radius, GeoUnit geoUnit, int count) { - return commandExecutor.writeAsync(getName(), LongCodec.INSTANCE, RedisCommands.GEORADIUS_STORE_INT, fromKey, convert(longitude), convert(latitude), radius, geoUnit, "COUNT", count, "STORE", getName()); + public RFuture radiusStoreToAsync(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit, int count) { + return commandExecutor.writeAsync(getName(), LongCodec.INSTANCE, RedisCommands.GEORADIUS_STORE_INT, getName(), convert(longitude), convert(latitude), radius, geoUnit, "COUNT", count, "STORE", destName); } @Override - public int radiusStore(String fromKey, double longitude, double latitude, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count) { - return get(radiusStoreAsync(fromKey, longitude, latitude, radius, geoUnit, geoOrder, count)); + public int radiusStoreTo(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count) { + return get(radiusStoreToAsync(destName, longitude, latitude, radius, geoUnit, geoOrder, count)); } @Override - public RFuture radiusStoreAsync(String fromKey, double longitude, double latitude, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count) { - return commandExecutor.writeAsync(getName(), LongCodec.INSTANCE, RedisCommands.GEORADIUS_STORE_INT, fromKey, convert(longitude), convert(latitude), radius, geoUnit, geoOrder, "COUNT", count, "STORE", getName()); + public RFuture radiusStoreToAsync(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count) { + return commandExecutor.writeAsync(getName(), LongCodec.INSTANCE, RedisCommands.GEORADIUS_STORE_INT, getName(), convert(longitude), convert(latitude), radius, geoUnit, geoOrder, "COUNT", count, "STORE", destName); } @Override - public int radiusStore(String fromKey, V member, double radius, GeoUnit geoUnit) { - return get(radiusStoreAsync(fromKey, member, radius, geoUnit)); + public int radiusStoreTo(String destName, V member, double radius, GeoUnit geoUnit) { + return get(radiusStoreToAsync(destName, member, radius, geoUnit)); } @Override - public RFuture radiusStoreAsync(String fromKey, V member, double radius, GeoUnit geoUnit) { - return commandExecutor.writeAsync(getName(), codec, RedisCommands.GEORADIUSBYMEMBER_STORE_INT, fromKey, member, radius, geoUnit, "STORE", getName()); + public RFuture radiusStoreToAsync(String destName, V member, double radius, GeoUnit geoUnit) { + return commandExecutor.writeAsync(getName(), codec, RedisCommands.GEORADIUSBYMEMBER_STORE_INT, getName(), member, radius, geoUnit, "STORE", destName); } @Override - public int radiusStore(String fromKey, V member, double radius, GeoUnit geoUnit, int count) { - return get(radiusStoreAsync(fromKey, member, radius, geoUnit, count)); + public int radiusStoreTo(String destName, V member, double radius, GeoUnit geoUnit, int count) { + return get(radiusStoreToAsync(destName, member, radius, geoUnit, count)); } @Override - public RFuture radiusStoreAsync(String fromKey, V member, double radius, GeoUnit geoUnit, int count) { - return commandExecutor.writeAsync(getName(), codec, RedisCommands.GEORADIUSBYMEMBER_STORE_INT, fromKey, member, radius, geoUnit, "COUNT", count, "STORE", getName()); + public RFuture radiusStoreToAsync(String destName, V member, double radius, GeoUnit geoUnit, int count) { + return commandExecutor.writeAsync(getName(), codec, RedisCommands.GEORADIUSBYMEMBER_STORE_INT, getName(), member, radius, geoUnit, "COUNT", count, "STORE", destName); } @Override - public int radiusStore(String fromKey, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count) { - return get(radiusStoreAsync(fromKey, member, radius, geoUnit, geoOrder, count)); + public int radiusStoreTo(String destName, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count) { + return get(radiusStoreToAsync(destName, member, radius, geoUnit, geoOrder, count)); } @Override - public RFuture radiusStoreAsync(String fromKey, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count) { - return commandExecutor.writeAsync(getName(), codec, RedisCommands.GEORADIUSBYMEMBER_STORE_INT, fromKey, member, radius, geoUnit, geoOrder, "COUNT", count, "STORE", getName()); + public RFuture radiusStoreToAsync(String destName, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count) { + return commandExecutor.writeAsync(getName(), codec, RedisCommands.GEORADIUSBYMEMBER_STORE_INT, getName(), member, radius, geoUnit, geoOrder, "COUNT", count, "STORE", destName); } } diff --git a/redisson/src/main/java/org/redisson/api/RGeo.java b/redisson/src/main/java/org/redisson/api/RGeo.java index ccc9ed113..610cfd7fa 100644 --- a/redisson/src/main/java/org/redisson/api/RGeo.java +++ b/redisson/src/main/java/org/redisson/api/RGeo.java @@ -450,25 +450,25 @@ 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. - * Store result to current Geo. + * Store result to destName. * - * @param fromKey - source Geo key + * @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 */ - int radiusStore(String fromKey, double longitude, double latitude, double radius, GeoUnit geoUnit); + int radiusStoreTo(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 - * Store result to current Geo. + * Store result to destName. * - * @param fromKey - source Geo key + * @param destName - Geo object destination * @param longitude - longitude of object * @param latitude - latitude of object * @param radius - radius in geo units @@ -476,7 +476,7 @@ public interface RGeo extends RScoredSortedSet, RGeoAsync { * @param count - result limit * @return length of result */ - int radiusStore(String fromKey, double longitude, double latitude, double radius, GeoUnit geoUnit, int count); + int radiusStoreTo(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit, int count); /** * Finds the members of a sorted set, which are within the @@ -484,9 +484,9 @@ public interface RGeo extends RScoredSortedSet, RGeoAsync { * and the maximum distance from the center (the radius) * in GeoUnit units with GeoOrder * and limited by count - * Store result to current Geo. + * Store result to destName. * - * @param fromKey - source Geo key + * @param destName - Geo object destination * @param longitude - longitude of object * @param latitude - latitude of object * @param radius - radius in geo units @@ -495,47 +495,47 @@ public interface RGeo extends RScoredSortedSet, RGeoAsync { * @param count - result limit * @return length of result */ - int radiusStore(String fromKey, double longitude, double latitude, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count); + int radiusStoreTo(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. - * Store result to current Geo. + * Store result to destName. * - * @param fromKey - source Geo key + * @param destName - Geo object destination * @param member - object * @param radius - radius in geo units * @param geoUnit - geo unit * @return length of result */ - int radiusStore(String fromKey, V member, double radius, GeoUnit geoUnit); + int radiusStoreTo(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 - * Store result to current Geo. + * Store result to destName. * - * @param fromKey - source Geo key + * @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 */ - int radiusStore(String fromKey, V member, double radius, GeoUnit geoUnit, int count); + int radiusStoreTo(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 - * Store result to current Geo. + * Store result to destName. * - * @param fromKey - source Geo key + * @param destName - Geo object destination * @param member - object * @param radius - radius in geo units * @param geoUnit - geo unit @@ -543,6 +543,6 @@ public interface RGeo extends RScoredSortedSet, RGeoAsync { * @param count - result limit * @return length of result */ - int radiusStore(String fromKey, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count); + int radiusStoreTo(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 477a0d96c..8f9750a02 100644 --- a/redisson/src/main/java/org/redisson/api/RGeoAsync.java +++ b/redisson/src/main/java/org/redisson/api/RGeoAsync.java @@ -448,25 +448,25 @@ 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. - * Store result to current Geo. + * Store result to destName. * - * @param fromKey - source Geo key + * @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 radiusStoreAsync(String fromKey, double longitude, double latitude, double radius, GeoUnit geoUnit); + RFuture radiusStoreToAsync(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 - * Store result to current Geo. + * Store result to destName. * - * @param fromKey - source Geo key + * @param destName - Geo object destination * @param longitude - longitude of object * @param latitude - latitude of object * @param radius - radius in geo units @@ -474,7 +474,7 @@ public interface RGeoAsync extends RScoredSortedSetAsync { * @param count - result limit * @return length of result */ - RFuture radiusStoreAsync(String fromKey, double longitude, double latitude, double radius, GeoUnit geoUnit, int count); + RFuture radiusStoreToAsync(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit, int count); /** * Finds the members of a sorted set, which are within the @@ -482,9 +482,9 @@ public interface RGeoAsync extends RScoredSortedSetAsync { * and the maximum distance from the center (the radius) * in GeoUnit units with GeoOrder * and limited by count - * Store result to current Geo. + * Store result to destName. * - * @param fromKey - source Geo key + * @param destName - Geo object destination * @param longitude - longitude of object * @param latitude - latitude of object * @param radius - radius in geo units @@ -493,47 +493,47 @@ public interface RGeoAsync extends RScoredSortedSetAsync { * @param count - result limit * @return length of result */ - RFuture radiusStoreAsync(String fromKey, double longitude, double latitude, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count); + RFuture radiusStoreToAsync(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. - * Store result to current Geo. + * Store result to destName. * - * @param fromKey - source Geo key + * @param destName - Geo object destination * @param member - object * @param radius - radius in geo units * @param geoUnit - geo unit * @return length of result */ - RFuture radiusStoreAsync(String fromKey, V member, double radius, GeoUnit geoUnit); + RFuture radiusStoreToAsync(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 - * Store result to current Geo. + * Store result to destName. * - * @param fromKey - source Geo key + * @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 radiusStoreAsync(String fromKey, V member, double radius, GeoUnit geoUnit, int count); + RFuture radiusStoreToAsync(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 - * Store result to current Geo. + * Store result to destName. * - * @param fromKey - source Geo key + * @param destName - Geo object destination * @param member - object * @param radius - radius in geo units * @param geoUnit - geo unit @@ -541,6 +541,6 @@ public interface RGeoAsync extends RScoredSortedSetAsync { * @param count - result limit * @return length of result */ - RFuture radiusStoreAsync(String fromKey, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count); + RFuture radiusStoreToAsync(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 87af69633..69ab4fedf 100644 --- a/redisson/src/test/java/org/redisson/RedissonGeoTest.java +++ b/redisson/src/test/java/org/redisson/RedissonGeoTest.java @@ -482,7 +482,7 @@ public class RedissonGeoTest extends BaseTest { RGeo geoDest = redisson.getGeo("test-store"); geoSource.add(new GeoEntry(13.361389, 38.115556, "Palermo"), new GeoEntry(15.087269, 37.502669, "Catania")); - assertThat(geoDest.radiusStore(geoSource.getName(), 15, 37, 200, GeoUnit.KILOMETERS)).isEqualTo(2); + assertThat(geoSource.radiusStoreTo(geoDest.getName(), 15, 37, 200, GeoUnit.KILOMETERS)).isEqualTo(2); assertThat(geoDest.readAll()).containsExactlyInAnyOrder("Palermo", "Catania"); } @@ -492,7 +492,7 @@ public class RedissonGeoTest extends BaseTest { RGeo geoDest = redisson.getGeo("test-store"); geoSource.add(new GeoEntry(13.361389, 38.115556, "Palermo"), new GeoEntry(15.087269, 37.502669, "Catania")); - assertThat(geoDest.radiusStore(geoSource.getName(), 15, 37, 200, GeoUnit.KILOMETERS, 1)).isEqualTo(1); + assertThat(geoSource.radiusStoreTo(geoDest.getName(), 15, 37, 200, GeoUnit.KILOMETERS, 1)).isEqualTo(1); assertThat(geoDest.readAll()).containsExactly("Catania"); } @@ -502,10 +502,10 @@ public class RedissonGeoTest extends BaseTest { RGeo geoDest = redisson.getGeo("test-store"); geoSource.add(new GeoEntry(13.361389, 38.115556, "Palermo"), new GeoEntry(15.087269, 37.502669, "Catania")); - assertThat(geoDest.radiusStore(geoSource.getName(), 15, 37, 200, GeoUnit.KILOMETERS, GeoOrder.DESC, 1)).isEqualTo(1); + assertThat(geoSource.radiusStoreTo(geoDest.getName(), 15, 37, 200, GeoUnit.KILOMETERS, GeoOrder.DESC, 1)).isEqualTo(1); assertThat(geoDest.readAll()).containsExactly("Palermo"); - assertThat(geoDest.radiusStore(geoSource.getName(), 15, 37, 200, GeoUnit.KILOMETERS, GeoOrder.ASC, 1)).isEqualTo(1); + assertThat(geoSource.radiusStoreTo(geoDest.getName(), 15, 37, 200, GeoUnit.KILOMETERS, GeoOrder.ASC, 1)).isEqualTo(1); assertThat(geoDest.readAll()).containsExactly("Catania"); } @@ -514,7 +514,7 @@ public class RedissonGeoTest extends BaseTest { RGeo geoSource = redisson.getGeo("test"); RGeo geoDest = redisson.getGeo("test-store"); - assertThat(geoDest.radiusStore(geoSource.getName(), 15, 37, 200, GeoUnit.KILOMETERS)).isEqualTo(0); + assertThat(geoSource.radiusStoreTo(geoDest.getName(), 15, 37, 200, GeoUnit.KILOMETERS)).isEqualTo(0); assertThat(geoDest.readAll()).isEmpty(); } @@ -524,7 +524,7 @@ public class RedissonGeoTest extends BaseTest { RGeo geoDest = redisson.getGeo("test-store"); geoSource.add(new GeoEntry(13.361389, 38.115556, "Palermo"), new GeoEntry(15.087269, 37.502669, "Catania")); - assertThat(geoDest.radiusStore(geoSource.getName(), "Palermo", 200, GeoUnit.KILOMETERS)).isEqualTo(2); + assertThat(geoSource.radiusStoreTo(geoDest.getName(), "Palermo", 200, GeoUnit.KILOMETERS)).isEqualTo(2); assertThat(geoDest.readAll()).containsExactlyInAnyOrder("Palermo", "Catania"); } @@ -534,7 +534,7 @@ public class RedissonGeoTest extends BaseTest { RGeo geoDest = redisson.getGeo("test-store"); geoSource.add(new GeoEntry(13.361389, 38.115556, "Palermo"), new GeoEntry(15.087269, 37.502669, "Catania")); - assertThat(geoDest.radiusStore(geoSource.getName(), "Palermo", 200, GeoUnit.KILOMETERS, 1)).isEqualTo(1); + assertThat(geoSource.radiusStoreTo(geoDest.getName(), "Palermo", 200, GeoUnit.KILOMETERS, 1)).isEqualTo(1); assertThat(geoDest.readAll()).containsExactly("Palermo"); } @@ -544,10 +544,10 @@ public class RedissonGeoTest extends BaseTest { RGeo geoDest = redisson.getGeo("test-store"); geoSource.add(new GeoEntry(13.361389, 38.115556, "Palermo"), new GeoEntry(15.087269, 37.502669, "Catania")); - assertThat(geoDest.radiusStore(geoSource.getName(), "Palermo", 200, GeoUnit.KILOMETERS, GeoOrder.DESC, 1)).isEqualTo(1); + assertThat(geoSource.radiusStoreTo(geoDest.getName(), "Palermo", 200, GeoUnit.KILOMETERS, GeoOrder.DESC, 1)).isEqualTo(1); assertThat(geoDest.readAll()).containsExactly("Catania"); - assertThat(geoDest.radiusStore(geoSource.getName(), "Palermo", 200, GeoUnit.KILOMETERS, GeoOrder.ASC, 1)).isEqualTo(1); + assertThat(geoSource.radiusStoreTo(geoDest.getName(), "Palermo", 200, GeoUnit.KILOMETERS, GeoOrder.ASC, 1)).isEqualTo(1); assertThat(geoDest.readAll()).containsExactly("Palermo"); } @@ -556,7 +556,7 @@ public class RedissonGeoTest extends BaseTest { RGeo geoSource = redisson.getGeo("test"); RGeo geoDest = redisson.getGeo("test-store"); - assertThat(geoDest.radiusStore(geoSource.getName(), "Palermo", 200, GeoUnit.KILOMETERS)).isEqualTo(0); + assertThat(geoSource.radiusStoreTo(geoDest.getName(), "Palermo", 200, GeoUnit.KILOMETERS)).isEqualTo(0); assertThat(geoDest.readAll()).isEmpty(); }