change API "radiusStore()" -> "radiusStoreTo()"

From @mrniko's feedback, to match RSortable API.
Read from current Geo, store to destName.
pull/869/head
Cory Sherman 8 years ago
parent cbb485cb0b
commit df0d135980

@ -407,63 +407,63 @@ public class RedissonGeo<V> extends RedissonScoredSortedSet<V> implements RGeo<V
}
@Override
public int radiusStore(String fromKey, double longitude, double latitude, double radius, GeoUnit geoUnit) {
return get(radiusStoreAsync(fromKey, longitude, latitude, radius, geoUnit));
public int radiusStoreTo(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit) {
return get(radiusStoreToAsync(destName, longitude, latitude, radius, geoUnit));
}
@Override
public RFuture<Integer> 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<Integer> 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<Integer> 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<Integer> 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<Integer> 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<Integer> 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<Integer> 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<Integer> 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<Integer> 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<Integer> 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<Integer> 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<Integer> 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);
}
}

@ -450,25 +450,25 @@ public interface RGeo<V> extends RScoredSortedSet<V>, RGeoAsync<V> {
* borders of the area specified with the center location
* and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units.
* Store result to current Geo.
* Store result to <code>destName</code>.
*
* @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 <code>GeoUnit</code> units and limited by count
* Store result to current Geo.
* Store result to <code>destName</code>.
*
* @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<V> extends RScoredSortedSet<V>, RGeoAsync<V> {
* @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<V> extends RScoredSortedSet<V>, RGeoAsync<V> {
* and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
* and limited by count
* Store result to current Geo.
* Store result to <code>destName</code>.
*
* @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<V> extends RScoredSortedSet<V>, RGeoAsync<V> {
* @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 <code>GeoUnit</code> units.
* Store result to current Geo.
* Store result to <code>destName</code>.
*
* @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 <code>GeoUnit</code> units and limited by count
* Store result to current Geo.
* Store result to <code>destName</code>.
*
* @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 <code>GeoUnit</code> units with <code>GeoOrder</code>
* Store result to current Geo.
* Store result to <code>destName</code>.
*
* @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<V> extends RScoredSortedSet<V>, RGeoAsync<V> {
* @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);
}

@ -448,25 +448,25 @@ public interface RGeoAsync<V> extends RScoredSortedSetAsync<V> {
* borders of the area specified with the center location
* and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units.
* Store result to current Geo.
* Store result to <code>destName</code>.
*
* @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<Integer> radiusStoreAsync(String fromKey, double longitude, double latitude, double radius, GeoUnit geoUnit);
RFuture<Integer> 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 <code>GeoUnit</code> units and limited by count
* Store result to current Geo.
* Store result to <code>destName</code>.
*
* @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<V> extends RScoredSortedSetAsync<V> {
* @param count - result limit
* @return length of result
*/
RFuture<Integer> radiusStoreAsync(String fromKey, double longitude, double latitude, double radius, GeoUnit geoUnit, int count);
RFuture<Integer> 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<V> extends RScoredSortedSetAsync<V> {
* and the maximum distance from the center (the radius)
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
* and limited by count
* Store result to current Geo.
* Store result to <code>destName</code>.
*
* @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<V> extends RScoredSortedSetAsync<V> {
* @param count - result limit
* @return length of result
*/
RFuture<Integer> radiusStoreAsync(String fromKey, double longitude, double latitude, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count);
RFuture<Integer> 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 <code>GeoUnit</code> units.
* Store result to current Geo.
* Store result to <code>destName</code>.
*
* @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<Integer> radiusStoreAsync(String fromKey, V member, double radius, GeoUnit geoUnit);
RFuture<Integer> 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 <code>GeoUnit</code> units and limited by count
* Store result to current Geo.
* Store result to <code>destName</code>.
*
* @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<Integer> radiusStoreAsync(String fromKey, V member, double radius, GeoUnit geoUnit, int count);
RFuture<Integer> 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 <code>GeoUnit</code> units with <code>GeoOrder</code>
* Store result to current Geo.
* Store result to <code>destName</code>.
*
* @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<V> extends RScoredSortedSetAsync<V> {
* @param count - result limit
* @return length of result
*/
RFuture<Integer> radiusStoreAsync(String fromKey, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count);
RFuture<Integer> radiusStoreToAsync(String destName, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count);
}

@ -482,7 +482,7 @@ public class RedissonGeoTest extends BaseTest {
RGeo<String> 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<String> 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<String> 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<String> geoSource = redisson.getGeo("test");
RGeo<String> 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<String> 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<String> 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<String> 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<String> geoSource = redisson.getGeo("test");
RGeo<String> 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();
}

Loading…
Cancel
Save