Package org.redisson

Class RedissonGeo<V>

    • Method Detail

      • addAsync

        public RFuture<Long> addAsync(double longitude,
                                      double latitude,
                                      V member)
        Description copied from interface: RGeoAsync
        Adds geospatial member.
        Specified by:
        addAsync in interface RGeoAsync<V>
        Parameters:
        longitude - - longitude of object
        latitude - - latitude of object
        member - - object itself
        Returns:
        number of elements added to the sorted set, not including elements already existing for which the score was updated
      • add

        public long add(double longitude,
                        double latitude,
                        V member)
        Description copied from interface: RGeo
        Adds geospatial member.
        Specified by:
        add in interface RGeo<V>
        Parameters:
        longitude - - longitude of object
        latitude - - latitude of object
        member - - object itself
        Returns:
        number of elements added to the sorted set, not including elements already existing for which the score was updated
      • add

        public long add(GeoEntry... entries)
        Description copied from interface: RGeo
        Adds geospatial members.
        Specified by:
        add in interface RGeo<V>
        Parameters:
        entries - - objects
        Returns:
        number of elements added to the sorted set, not including elements already existing for which the score was updated
      • addAsync

        public RFuture<Long> addAsync(GeoEntry... entries)
        Description copied from interface: RGeoAsync
        Adds geospatial members.
        Specified by:
        addAsync in interface RGeoAsync<V>
        Parameters:
        entries - - objects
        Returns:
        number of elements added to the sorted set, not including elements already existing for which the score was updated
      • addIfExists

        public Boolean addIfExists(double longitude,
                                   double latitude,
                                   V member)
        Description copied from interface: RGeo
        Adds geospatial member only if it's already exists.

        Requires Redis 6.2.0 and higher.

        Specified by:
        addIfExists in interface RGeo<V>
        Parameters:
        longitude - - longitude of object
        latitude - - latitude of object
        member - - object itself
        Returns:
        number of elements added to the sorted set
      • addIfExists

        public long addIfExists(GeoEntry... entries)
        Description copied from interface: RGeo
        Adds geospatial members only if it's already exists.

        Requires Redis 6.2.0 and higher.

        Specified by:
        addIfExists in interface RGeo<V>
        Parameters:
        entries - - objects
        Returns:
        number of elements added to the sorted set
      • addIfExistsAsync

        public RFuture<Boolean> addIfExistsAsync(double longitude,
                                                 double latitude,
                                                 V member)
        Description copied from interface: RGeoAsync
        Adds geospatial member only if it's already exists.

        Requires Redis 6.2.0 and higher.

        Specified by:
        addIfExistsAsync in interface RGeoAsync<V>
        Parameters:
        longitude - - longitude of object
        latitude - - latitude of object
        member - - object itself
        Returns:
        number of elements added to the sorted set
      • addIfExistsAsync

        public RFuture<Long> addIfExistsAsync(GeoEntry... entries)
        Description copied from interface: RGeoAsync
        Adds geospatial members only if it's already exists.

        Requires Redis 6.2.0 and higher.

        Specified by:
        addIfExistsAsync in interface RGeoAsync<V>
        Parameters:
        entries - - objects
        Returns:
        number of elements added to the sorted set
      • tryAdd

        public boolean tryAdd(double longitude,
                              double latitude,
                              V member)
        Description copied from interface: RGeo
        Adds geospatial member only if has not been added before.

        Requires Redis 6.2.0 and higher.

        Specified by:
        tryAdd in interface RGeo<V>
        Parameters:
        longitude - - longitude of object
        latitude - - latitude of object
        member - - object itself
        Returns:
        number of elements added to the sorted set
      • tryAdd

        public long tryAdd(GeoEntry... entries)
        Description copied from interface: RGeo
        Adds geospatial members only if has not been added before.

        Requires Redis 6.2.0 and higher.

        Specified by:
        tryAdd in interface RGeo<V>
        Parameters:
        entries - - objects
        Returns:
        number of elements added to the sorted set
      • tryAddAsync

        public RFuture<Boolean> tryAddAsync(double longitude,
                                            double latitude,
                                            V member)
        Description copied from interface: RGeoAsync
        Adds geospatial member only if has not been added before.

        Requires Redis 6.2.0 and higher.

        Specified by:
        tryAddAsync in interface RGeoAsync<V>
        Parameters:
        longitude - - longitude of object
        latitude - - latitude of object
        member - - object itself
        Returns:
        number of elements added to the sorted set
      • tryAddAsync

        public RFuture<Long> tryAddAsync(GeoEntry... entries)
        Description copied from interface: RGeoAsync
        Adds geospatial members only if has not been added before.

        Requires Redis 6.2.0 and higher.

        Specified by:
        tryAddAsync in interface RGeoAsync<V>
        Parameters:
        entries - - objects
        Returns:
        number of elements added to the sorted set
      • dist

        public Double dist(V firstMember,
                           V secondMember,
                           GeoUnit geoUnit)
        Description copied from interface: RGeo
        Returns distance between members in GeoUnit units.
        Specified by:
        dist in interface RGeo<V>
        Parameters:
        firstMember - - first object
        secondMember - - second object
        geoUnit - - geo unit
        Returns:
        distance
      • distAsync

        public RFuture<Double> distAsync(V firstMember,
                                         V secondMember,
                                         GeoUnit geoUnit)
        Description copied from interface: RGeoAsync
        Returns distance between members in GeoUnit units.
        Specified by:
        distAsync in interface RGeoAsync<V>
        Parameters:
        firstMember - - first object
        secondMember - - second object
        geoUnit - - geo unit
        Returns:
        distance
      • hash

        public Map<V,String> hash(V... members)
        Description copied from interface: RGeo
        Returns 11 characters long Geohash string mapped by defined member.
        Specified by:
        hash in interface RGeo<V>
        Parameters:
        members - - objects
        Returns:
        hash mapped by object
      • hashAsync

        public RFuture<Map<V,String>> hashAsync(V... members)
        Description copied from interface: RGeoAsync
        Returns 11 characters Geohash string mapped by defined member.
        Specified by:
        hashAsync in interface RGeoAsync<V>
        Parameters:
        members - - objects
        Returns:
        hash mapped by object
      • pos

        public Map<V,GeoPosition> pos(V... members)
        Description copied from interface: RGeo
        Returns geo-position mapped by defined member.
        Specified by:
        pos in interface RGeo<V>
        Parameters:
        members - - objects
        Returns:
        geo position mapped by object
      • posAsync

        public RFuture<Map<V,GeoPosition>> posAsync(V... members)
        Description copied from interface: RGeoAsync
        Returns geo-position mapped by defined member.
        Specified by:
        posAsync in interface RGeoAsync<V>
        Parameters:
        members - - objects
        Returns:
        geo position mapped by object
      • search

        public List<V> search(GeoSearchArgs args)
        Description copied from interface: RGeo
        Returns the members of a sorted set, which are within the borders of specified search conditions.

        Usage examples:

         List objects = geo.search(GeoSearchArgs.from(15, 37)
                                         .radius(200, GeoUnit.KILOMETERS)
                                         .order(GeoOrder.ASC)
                                         .count(1)));
         
         List objects = geo.search(GeoSearchArgs.from(15, 37)
                                         .radius(200, GeoUnit.KILOMETERS)));
         

        Requires Redis 3.2.10 and higher.

        Specified by:
        search in interface RGeo<V>
        Parameters:
        args - - search conditions object
        Returns:
        list of memebers
      • searchAsync

        public RFuture<List<V>> searchAsync(GeoSearchArgs args)
        Description copied from interface: RGeoAsync
        Returns the members of a sorted set, which are within the borders of specified search conditions.

        Usage examples:

         RFuture objects = geo.searchAsync(GeoSearchArgs.from(15, 37)
                                         .radius(200, GeoUnit.KILOMETERS)
                                         .order(GeoOrder.ASC)
                                         .count(1)));
         
         RFuture objects = geo.searchAsync(GeoSearchArgs.from(15, 37)
                                         .radius(200, GeoUnit.KILOMETERS)));
         

        Requires Redis 3.2.10 and higher.

        Specified by:
        searchAsync in interface RGeoAsync<V>
        Parameters:
        args - - search conditions object
        Returns:
        list of memebers
      • searchWithDistance

        public Map<V,Double> searchWithDistance(GeoSearchArgs args)
        Description copied from interface: RGeo
        Returns the distance mapped by member of a sorted set, which are within the borders of specified search conditions.

        Usage examples:

         List objects = geo.searchWithDistance(GeoSearchArgs.from(15, 37)
                                         .radius(200, GeoUnit.KILOMETERS)
                                         .order(GeoOrder.ASC)
                                         .count(1)));
         
         List objects = geo.searchWithDistance(GeoSearchArgs.from(15, 37)
                                         .radius(200, GeoUnit.KILOMETERS)));
         

        Requires Redis 3.2.10 and higher.

        Specified by:
        searchWithDistance in interface RGeo<V>
        Parameters:
        args - - search conditions object
        Returns:
        distance mapped by object
      • searchWithDistanceAsync

        public RFuture<Map<V,Double>> searchWithDistanceAsync(GeoSearchArgs args)
        Description copied from interface: RGeoAsync
        Returns the distance mapped by member of a sorted set, which are within the borders of specified search conditions.

        Usage examples:

         RFuture objects = geo.searchWithDistanceAsync(GeoSearchArgs.from(15, 37)
                                         .radius(200, GeoUnit.KILOMETERS)
                                         .order(GeoOrder.ASC)
                                         .count(1)));
         
         RFuture objects = geo.searchWithDistanceAsync(GeoSearchArgs.from(15, 37)
                                         .radius(200, GeoUnit.KILOMETERS)));
         

        Requires Redis 3.2.10 and higher.

        Specified by:
        searchWithDistanceAsync in interface RGeoAsync<V>
        Parameters:
        args - - search conditions object
        Returns:
        distance mapped by object
      • searchWithPosition

        public Map<V,GeoPosition> searchWithPosition(GeoSearchArgs args)
        Description copied from interface: RGeo
        Returns the position mapped by member of a sorted set, which are within the borders of specified search conditions.

        Usage examples:

         List objects = geo.searchWithPosition(GeoSearchArgs.from(15, 37)
                                         .radius(200, GeoUnit.KILOMETERS)
                                         .order(GeoOrder.ASC)
                                         .count(1)));
         
         List objects = geo.searchWithPosition(GeoSearchArgs.from(15, 37)
                                         .radius(200, GeoUnit.KILOMETERS)));
         

        Requires Redis 3.2.10 and higher.

        Specified by:
        searchWithPosition in interface RGeo<V>
        Parameters:
        args - - search conditions object
        Returns:
        position mapped by object
      • searchWithPositionAsync

        public RFuture<Map<V,GeoPosition>> searchWithPositionAsync(GeoSearchArgs args)
        Description copied from interface: RGeoAsync
        Returns the position mapped by member of a sorted set, which are within the borders of specified search conditions.

        Usage examples:

         List objects = geo.searchWithPosition(GeoSearchArgs.from(15, 37)
                                         .radius(200, GeoUnit.KILOMETERS)
                                         .order(GeoOrder.ASC)
                                         .count(1)));
         
         List objects = geo.searchWithPosition(GeoSearchArgs.from(15, 37)
                                         .radius(200, GeoUnit.KILOMETERS)));
         

        Requires Redis 3.2.10 and higher.

        Specified by:
        searchWithPositionAsync in interface RGeoAsync<V>
        Parameters:
        args - - search conditions object
        Returns:
        position mapped by object
      • radius

        public List<V> radius(double longitude,
                              double latitude,
                              double radius,
                              GeoUnit geoUnit)
        Specified by:
        radius in interface RGeo<V>
      • radius

        public List<V> radius(double longitude,
                              double latitude,
                              double radius,
                              GeoUnit geoUnit,
                              int count)
        Specified by:
        radius in interface RGeo<V>
      • radius

        public List<V> radius(double longitude,
                              double latitude,
                              double radius,
                              GeoUnit geoUnit,
                              GeoOrder geoOrder)
        Specified by:
        radius in interface RGeo<V>
      • radius

        public List<V> radius(double longitude,
                              double latitude,
                              double radius,
                              GeoUnit geoUnit,
                              GeoOrder geoOrder,
                              int count)
        Specified by:
        radius in interface RGeo<V>
      • radiusWithDistance

        public Map<V,Double> radiusWithDistance(double longitude,
                                                      double latitude,
                                                      double radius,
                                                      GeoUnit geoUnit,
                                                      int count)
        Specified by:
        radiusWithDistance in interface RGeo<V>
      • radius

        public List<V> radius(V member,
                              double radius,
                              GeoUnit geoUnit)
        Specified by:
        radius in interface RGeo<V>
      • radius

        public List<V> radius(V member,
                              double radius,
                              GeoUnit geoUnit,
                              int count)
        Specified by:
        radius in interface RGeo<V>
      • radiusStoreTo

        public long radiusStoreTo(String destName,
                                  double longitude,
                                  double latitude,
                                  double radius,
                                  GeoUnit geoUnit)
        Specified by:
        radiusStoreTo in interface RGeo<V>
      • storeSearchTo

        public long storeSearchTo(String destName,
                                  GeoSearchArgs args)
        Description copied from interface: RGeo
        Finds the members of a sorted set, which are within the borders of specified search conditions.

        Stores result to destName.

        Usage examples:

         long count = geo.storeSearchTo(GeoSearchArgs.from(15, 37)
                                         .radius(200, GeoUnit.KILOMETERS)
                                         .order(GeoOrder.ASC)
                                         .count(1)));
         
         long count = geo.storeSearchTo(GeoSearchArgs.from(15, 37)
                                         .radius(200, GeoUnit.KILOMETERS)));
         
        Specified by:
        storeSearchTo in interface RGeo<V>
        args - - search conditions object
        Returns:
        length of result
      • storeSearchToAsync

        public RFuture<Long> storeSearchToAsync(String destName,
                                                GeoSearchArgs args)
        Description copied from interface: RGeoAsync
        Finds the members of a sorted set, which are within the borders of specified search conditions.

        Stores result to destName.

        Usage examples:

         long count = geo.storeSearchTo(GeoSearchArgs.from(15, 37)
                                         .radius(200, GeoUnit.KILOMETERS)
                                         .order(GeoOrder.ASC)
                                         .count(1)));
         
         long count = geo.storeSearchTo(GeoSearchArgs.from(15, 37)
                                         .radius(200, GeoUnit.KILOMETERS)));
         
        Specified by:
        storeSearchToAsync in interface RGeoAsync<V>
        args - - search conditions object
        Returns:
        length of result
      • radiusStoreTo

        public long radiusStoreTo(String destName,
                                  double longitude,
                                  double latitude,
                                  double radius,
                                  GeoUnit geoUnit,
                                  int count)
        Specified by:
        radiusStoreTo in interface RGeo<V>
      • radiusStoreTo

        public long radiusStoreTo(String destName,
                                  double longitude,
                                  double latitude,
                                  double radius,
                                  GeoUnit geoUnit,
                                  GeoOrder geoOrder,
                                  int count)
        Specified by:
        radiusStoreTo in interface RGeo<V>
      • radiusStoreTo

        public long radiusStoreTo(String destName,
                                  V member,
                                  double radius,
                                  GeoUnit geoUnit,
                                  int count)
        Specified by:
        radiusStoreTo in interface RGeo<V>
      • storeSortedSearchTo

        public long storeSortedSearchTo(String destName,
                                        GeoSearchArgs args)
        Description copied from interface: RGeo
        Finds the members of a sorted set, which are within the borders of specified search conditions.

        Stores result to destName sorted by distance.

        Usage examples:

         long count = geo.storeSortedSearchTo(GeoSearchArgs.from(15, 37)
                                         .radius(200, GeoUnit.KILOMETERS)
                                         .order(GeoOrder.ASC)
                                         .count(1)));
         
         long count = geo.storeSortedSearchTo(GeoSearchArgs.from(15, 37)
                                         .radius(200, GeoUnit.KILOMETERS)));
         
        Specified by:
        storeSortedSearchTo in interface RGeo<V>
        args - - search conditions object
        Returns:
        length of result
      • storeSortedSearchToAsync

        public RFuture<Long> storeSortedSearchToAsync(String destName,
                                                      GeoSearchArgs args)
        Description copied from interface: RGeoAsync
        Finds the members of a sorted set, which are within the borders of specified search conditions.

        Stores result to destName sorted by distance.

        Usage examples:

         long count = geo.storeSortedSearchTo(GeoSearchArgs.from(15, 37)
                                         .radius(200, GeoUnit.KILOMETERS)
                                         .order(GeoOrder.ASC)
                                         .count(1)));
         
         long count = geo.storeSortedSearchTo(GeoSearchArgs.from(15, 37)
                                         .radius(200, GeoUnit.KILOMETERS)));
         
        Specified by:
        storeSortedSearchToAsync in interface RGeoAsync<V>
        args - - search conditions object
        Returns:
        length of result
      • radiusStoreSortedTo

        public long radiusStoreSortedTo(String destName,
                                        double longitude,
                                        double latitude,
                                        double radius,
                                        GeoUnit geoUnit)
        Specified by:
        radiusStoreSortedTo in interface RGeo<V>
      • radiusStoreSortedTo

        public long radiusStoreSortedTo(String destName,
                                        double longitude,
                                        double latitude,
                                        double radius,
                                        GeoUnit geoUnit,
                                        int count)
        Specified by:
        radiusStoreSortedTo in interface RGeo<V>
      • radiusStoreSortedTo

        public long radiusStoreSortedTo(String destName,
                                        double longitude,
                                        double latitude,
                                        double radius,
                                        GeoUnit geoUnit,
                                        GeoOrder geoOrder,
                                        int count)
        Specified by:
        radiusStoreSortedTo in interface RGeo<V>
      • expire

        public boolean expire(long timeToLive,
                              TimeUnit timeUnit)
        Description copied from interface: RExpirable
        Set a timeout for object. After the timeout has expired, the key will automatically be deleted.
        Specified by:
        expire in interface RExpirable
        Parameters:
        timeToLive - - timeout before object will be deleted
        timeUnit - - timeout time unit
        Returns:
        true if the timeout was set and false if not
      • expireAsync

        public RFuture<Boolean> expireAsync(long timeToLive,
                                            TimeUnit timeUnit)
        Description copied from interface: RExpirableAsync
        Set a timeout for object in async mode. After the timeout has expired, the key will automatically be deleted.
        Specified by:
        expireAsync in interface RExpirableAsync
        Parameters:
        timeToLive - - timeout before object will be deleted
        timeUnit - - timeout time unit
        Returns:
        true if the timeout was set and false if not
      • expireAt

        public boolean expireAt(long timestamp)
        Description copied from interface: RExpirable
        Specified by:
        expireAt in interface RExpirable
        Parameters:
        timestamp - - expire date in milliseconds (Unix timestamp)
        Returns:
        true if the timeout was set and false if not
      • expire

        public boolean expire(Instant instant)
        Description copied from interface: RExpirable
        Set an expire date for object. When expire date comes the key will automatically be deleted.
        Specified by:
        expire in interface RExpirable
        Parameters:
        instant - - expire date
        Returns:
        true if the timeout was set and false if not
      • expireAsync

        public RFuture<Boolean> expireAsync(Instant instant)
        Description copied from interface: RExpirableAsync
        Set an expire date for object. When expire date comes the key will automatically be deleted.
        Specified by:
        expireAsync in interface RExpirableAsync
        Parameters:
        instant - - expire date
        Returns:
        true if the timeout was set and false if not
      • clearExpire

        public boolean clearExpire()
        Description copied from interface: RExpirable
        Clear an expire timeout or expire date for object.
        Specified by:
        clearExpire in interface RExpirable
        Returns:
        true if timeout was removed false if object does not exist or does not have an associated timeout
      • clearExpireAsync

        public RFuture<Boolean> clearExpireAsync()
        Description copied from interface: RExpirableAsync
        Clear an expire timeout or expire date for object in async mode. Object will not be deleted.
        Specified by:
        clearExpireAsync in interface RExpirableAsync
        Returns:
        true if the timeout was cleared and false if not
      • remainTimeToLive

        public long remainTimeToLive()
        Description copied from interface: RExpirable
        Remaining time to live of Redisson object that has a timeout
        Specified by:
        remainTimeToLive in interface RExpirable
        Returns:
        time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.
      • remainTimeToLiveAsync

        public RFuture<Long> remainTimeToLiveAsync()
        Description copied from interface: RExpirableAsync
        Remaining time to live of Redisson object that has a timeout
        Specified by:
        remainTimeToLiveAsync in interface RExpirableAsync
        Returns:
        time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expire.