Skip to content

Commit

Permalink
Documentation for geo commands #86
Browse files Browse the repository at this point in the history
More javadocs for the API
  • Loading branch information
mp911de committed Jun 23, 2015
1 parent 9b63872 commit bd66695
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 13 deletions.
24 changes: 24 additions & 0 deletions src/main/java/com/lambdaworks/redis/GeoArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import com.lambdaworks.redis.protocol.CommandArgs;

/**
* Args for {@literal GEORADIUS} and {@literal GEORADIUSBYMEMBER} commands.
*
* @author <a href="mailto:mpaluch@paluch.biz">Mark Paluch</a>
*/
public class GeoArgs {
Expand Down Expand Up @@ -33,23 +35,45 @@ public GeoArgs noProperties() {
return this;
}

/**
* Sort results ascending.
*
* @return the current geo args.
*/
public GeoArgs asc() {
return sort(Sort.asc);
}

/**
* Sort results descending.
*
* @return the current geo args.
*/
public GeoArgs desc() {
return sort(Sort.desc);
}

/**
* Sort results.
*
* @param sort
* @return the current geo args.
*/
public GeoArgs sort(Sort sort) {
this.sort = sort;
return this;
}

/**
* Sort order.
*/
public enum Sort {
asc, desc, none;
}

/**
* Supported geo unit.
*/
public enum Unit {
meter, kilometer, feet, mile;
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/lambdaworks/redis/RedisGeoAsyncConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public interface RedisGeoAsyncConnection<K, V> {
* @param latitude
* @param longitude
* @param member
* @return 1 if member is new or 0 if member is updated
* @return Long integer-reply the number of elements that were added to the set
*/
RedisFuture<Long> geoadd(K key, double latitude, double longitude, V member);

Expand All @@ -27,7 +27,7 @@ public interface RedisGeoAsyncConnection<K, V> {
*
* @param key
* @param latLonMember triplets of double latitude, double longitude and V member
* @return count of members submitted
* @return Long integer-reply the number of elements that were added to the set
*/
RedisFuture<Long> geoadd(K key, Object... latLonMember);

Expand All @@ -39,7 +39,7 @@ public interface RedisGeoAsyncConnection<K, V> {
* @param longitude
* @param distance
* @param unit
* @return
* @return bulk reply
*/
RedisFuture<Set<V>> georadius(K key, double latitude, double longitude, double distance, GeoArgs.Unit unit);

Expand All @@ -51,7 +51,7 @@ public interface RedisGeoAsyncConnection<K, V> {
* @param longitude
* @param distance
* @param unit
* @return
* @return nested multi-bulk reply
*/
RedisFuture<List<Object>> georadius(K key, double latitude, double longitude, double distance, GeoArgs.Unit unit,
GeoArgs geoArgs);
Expand All @@ -63,7 +63,7 @@ RedisFuture<List<Object>> georadius(K key, double latitude, double longitude, do
* @param member
* @param distance
* @param unit
* @return
* @return bulk reply
*/
RedisFuture<Set<V>> georadiusbymember(K key, V member, double distance, GeoArgs.Unit unit);

Expand All @@ -75,7 +75,7 @@ RedisFuture<List<Object>> georadius(K key, double latitude, double longitude, do
* @param member
* @param distance
* @param unit
* @return
* @return nested multi-bulk reply
*/
RedisFuture<List<Object>> georadiusbymember(K key, V member, double distance, GeoArgs.Unit unit, GeoArgs geoArgs);

Expand Down
14 changes: 7 additions & 7 deletions src/main/java/com/lambdaworks/redis/RedisGeoConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ public interface RedisGeoConnection<K, V> {
* @param latitude
* @param longitude
* @param member
* @return
* @return Long integer-reply the number of elements that were added to the set
*/
Long geoadd(K key, double latitude, double longitude, V member);

/**
* Multi geo add
* Multi geo add.
*
* @param key
* @param latLonMember triplets of double latitude, double longitude and V member
* @return
* @return Long integer-reply the number of elements that were added to the set
*/
Long geoadd(K key, Object... latLonMember);

Expand All @@ -39,7 +39,7 @@ public interface RedisGeoConnection<K, V> {
* @param longitude
* @param distance
* @param unit
* @return
* @return bulk reply
*/
Set<V> georadius(K key, double latitude, double longitude, double distance, GeoArgs.Unit unit);

Expand All @@ -51,7 +51,7 @@ public interface RedisGeoConnection<K, V> {
* @param longitude
* @param distance
* @param unit
* @return
* @return nested multi-bulk reply
*/
List<Object> georadius(K key, double latitude, double longitude, double distance, GeoArgs.Unit unit, GeoArgs geoArgs);

Expand All @@ -62,7 +62,7 @@ public interface RedisGeoConnection<K, V> {
* @param member
* @param distance
* @param unit
* @return
* @return bulk reply
*/
Set<V> georadiusbymember(K key, V member, double distance, GeoArgs.Unit unit);

Expand All @@ -74,7 +74,7 @@ public interface RedisGeoConnection<K, V> {
* @param member
* @param distance
* @param unit
* @return
* @return nested multi-bulk reply
*/
List<Object> georadiusbymember(K key, V member, double distance, GeoArgs.Unit unit, GeoArgs geoArgs);

Expand Down

0 comments on commit bd66695

Please sign in to comment.