Package org.redisson

Class RedissonVectorSet

java.lang.Object
org.redisson.RedissonObject
org.redisson.RedissonVectorSet
All Implemented Interfaces:
RExpirable, RExpirableAsync, RObject, RObjectAsync, RVectorSet, RVectorSetAsync

public final class RedissonVectorSet extends RedissonObject implements RVectorSet
Author:
Nikita Koksharov
  • Constructor Details

  • Method Details

    • add

      public boolean add(VectorAddArgs args)
      Description copied from interface: RVectorSet
      Adds an element
      Specified by:
      add in interface RVectorSet
      Parameters:
      args - add arguments
      Returns:
      true if element was added and false if updated
    • addAsync

      public RFuture<Boolean> addAsync(VectorAddArgs vargs)
      Description copied from interface: RVectorSetAsync
      Adds an element
      Specified by:
      addAsync in interface RVectorSetAsync
      Parameters:
      vargs - add arguments
      Returns:
      true if element was added and false if updated
    • size

      public int size()
      Description copied from interface: RVectorSet
      Returns the number of elements
      Specified by:
      size in interface RVectorSet
      Returns:
      number of elements
    • sizeAsync

      public RFuture<Integer> sizeAsync()
      Description copied from interface: RVectorSetAsync
      Returns the number of elements
      Specified by:
      sizeAsync in interface RVectorSetAsync
      Returns:
      number of elements
    • dimensions

      public int dimensions()
      Description copied from interface: RVectorSet
      Returns the number of dimensions of vectors
      Specified by:
      dimensions in interface RVectorSet
      Returns:
      dimensions count
    • dimensionsAsync

      public RFuture<Integer> dimensionsAsync()
      Description copied from interface: RVectorSetAsync
      Returns the number of dimensions of vectors
      Specified by:
      dimensionsAsync in interface RVectorSetAsync
      Returns:
      dimensions count
    • getVector

      public List<Double> getVector(String element)
      Description copied from interface: RVectorSet
      Retrieves approximate vector associated with a given element name
      Specified by:
      getVector in interface RVectorSet
      Parameters:
      element - element name
      Returns:
      list of vector coordinates
    • getVectorAsync

      public RFuture<List<Double>> getVectorAsync(String element)
      Description copied from interface: RVectorSetAsync
      Retrieves approximate vector associated with a given element name
      Specified by:
      getVectorAsync in interface RVectorSetAsync
      Parameters:
      element - element name
      Returns:
      list of vector coordinates
    • getRawVector

      public List<Object> getRawVector(String element)
      Description copied from interface: RVectorSet
      Retrieves raw internal representation of the approximate vector associated with a given element name
      Specified by:
      getRawVector in interface RVectorSet
      Parameters:
      element - element name
      Returns:
      list of raw vector values
    • getRawVectorAsync

      public RFuture<List<Object>> getRawVectorAsync(String element)
      Description copied from interface: RVectorSetAsync
      Retrieves raw internal representation of the approximate vector associated with a given element name
      Specified by:
      getRawVectorAsync in interface RVectorSetAsync
      Parameters:
      element - element name
      Returns:
      list of raw vector values
    • getAttributes

      public <T> T getAttributes(String element, Class<T> clazz)
      Description copied from interface: RVectorSet
      Retrieves attributes associated with a given element name
      Specified by:
      getAttributes in interface RVectorSet
      Parameters:
      element - element name
      clazz - type for deserialization
      Returns:
      attributes
    • getAttributesAsync

      public <T> RFuture<T> getAttributesAsync(String element, Class<T> clazz)
      Description copied from interface: RVectorSetAsync
      Retrieves attributes associated with a given element name
      Specified by:
      getAttributesAsync in interface RVectorSetAsync
      Parameters:
      element - element name
      clazz - type for deserialization
      Returns:
      attributes
    • getInfo

      public VectorInfo getInfo()
      Description copied from interface: RVectorSet
      Returns metadata for this vector set
      Specified by:
      getInfo in interface RVectorSet
      Returns:
      vector set information
    • getInfoAsync

      public RFuture<VectorInfo> getInfoAsync()
      Description copied from interface: RVectorSetAsync
      Returns metadata for this vector set
      Specified by:
      getInfoAsync in interface RVectorSetAsync
      Returns:
      vector set information
    • getNeighbors

      public List<String> getNeighbors(String element)
      Description copied from interface: RVectorSet
      Retrieves the neighbors of a specified element by name
      Specified by:
      getNeighbors in interface RVectorSet
      Parameters:
      element - element name
      Returns:
      list of neighbor element names
    • getNeighborsAsync

      public RFuture<List<String>> getNeighborsAsync(String element)
      Description copied from interface: RVectorSetAsync
      Retrieves the neighbors of a specified element by name
      Specified by:
      getNeighborsAsync in interface RVectorSetAsync
      Parameters:
      element - element name
      Returns:
      list of neighbor element names
    • getNeighborEntries

      public List<ScoredEntry<String>> getNeighborEntries(String element)
      Description copied from interface: RVectorSet
      Retrieves the neighbors with scores of a specified element by name
      Specified by:
      getNeighborEntries in interface RVectorSet
      Parameters:
      element - element name
      Returns:
      list of neighbor elements with scores
    • getNeighborEntriesAsync

      public RFuture<List<ScoredEntry<String>>> getNeighborEntriesAsync(String element)
      Description copied from interface: RVectorSetAsync
      Retrieves the neighbors with scores of a specified element by name
      Specified by:
      getNeighborEntriesAsync in interface RVectorSetAsync
      Parameters:
      element - element name
      Returns:
      list of neighbor elements with scores
    • random

      public String random()
      Description copied from interface: RVectorSet
      Returns a random element name
      Specified by:
      random in interface RVectorSet
      Returns:
      random element name
    • randomAsync

      public RFuture<String> randomAsync()
      Description copied from interface: RVectorSetAsync
      Returns a random element name
      Specified by:
      randomAsync in interface RVectorSetAsync
      Returns:
      random element name
    • random

      public List<String> random(int count)
      Description copied from interface: RVectorSet
      Returns random element names
      Specified by:
      random in interface RVectorSet
      Parameters:
      count - number of elements to return
      Returns:
      list of random element names
    • randomAsync

      public RFuture<List<String>> randomAsync(int count)
      Description copied from interface: RVectorSetAsync
      Returns random element names
      Specified by:
      randomAsync in interface RVectorSetAsync
      Parameters:
      count - number of elements to return
      Returns:
      list of random element names
    • remove

      public boolean remove(String element)
      Description copied from interface: RVectorSet
      Removes an element by name
      Specified by:
      remove in interface RVectorSet
      Parameters:
      element - element name to remove
      Returns:
      true if element was removed, false otherwise
    • removeAsync

      public RFuture<Boolean> removeAsync(String element)
      Description copied from interface: RVectorSetAsync
      Removes an element by name
      Specified by:
      removeAsync in interface RVectorSetAsync
      Parameters:
      element - element name to remove
      Returns:
      true if element was removed, false otherwise
    • setAttributes

      public boolean setAttributes(String element, Object attributes)
      Description copied from interface: RVectorSet
      Sets attributes for an element by name
      Specified by:
      setAttributes in interface RVectorSet
      Parameters:
      element - element name
      attributes - attributes
      Returns:
      true if attributes were set, false otherwise
    • setAttributesAsync

      public RFuture<Boolean> setAttributesAsync(String element, Object attributes)
      Description copied from interface: RVectorSetAsync
      Sets attributes for an element by name
      Specified by:
      setAttributesAsync in interface RVectorSetAsync
      Parameters:
      element - element name
      attributes - attributes
      Returns:
      true if attributes were set, false otherwise
    • getSimilar

      public List<String> getSimilar(VectorSimilarArgs args)
      Description copied from interface: RVectorSet
      Retrieves element names similar to a specified vector or element
      Specified by:
      getSimilar in interface RVectorSet
      Parameters:
      args - vector similarity arguments
      Returns:
      list of similar element names
    • getSimilarAsync

      public RFuture<List<String>> getSimilarAsync(VectorSimilarArgs vargs)
      Description copied from interface: RVectorSetAsync
      Retrieves element names similar to a specified vector or element
      Specified by:
      getSimilarAsync in interface RVectorSetAsync
      Parameters:
      vargs - vector similarity arguments
      Returns:
      list of similar element names
    • getSimilarEntries

      public List<ScoredEntry<String>> getSimilarEntries(VectorSimilarArgs args)
      Description copied from interface: RVectorSet
      Retrieves element names with scores similar to a given vector or element
      Specified by:
      getSimilarEntries in interface RVectorSet
      Parameters:
      args - similarity arguments
      Returns:
      list of similar element names with scores
    • getSimilarEntriesAsync

      public RFuture<List<ScoredEntry<String>>> getSimilarEntriesAsync(VectorSimilarArgs vargs)
      Description copied from interface: RVectorSetAsync
      Retrieves element names with scores similar to a given vector or element
      Specified by:
      getSimilarEntriesAsync in interface RVectorSetAsync
      Parameters:
      vargs - similarity arguments
      Returns:
      list of similar element names with scores
    • getSimilarEntriesWithAttributes

      public List<ScoreAttributesEntry<String>> getSimilarEntriesWithAttributes(VectorSimilarArgs args)
      Description copied from interface: RVectorSet
      Retrieves element names with scores and attributes similar to a given vector or element
      Specified by:
      getSimilarEntriesWithAttributes in interface RVectorSet
      Parameters:
      args - similarity arguments
      Returns:
      list of similar element names with scores and attributes
    • getSimilarEntriesWithAttributesAsync

      public RFuture<List<ScoreAttributesEntry<String>>> getSimilarEntriesWithAttributesAsync(VectorSimilarArgs vargs)
      Description copied from interface: RVectorSetAsync
      Retrieves element names with scores and attributes similar to a given vector or element
      Specified by:
      getSimilarEntriesWithAttributesAsync in interface RVectorSetAsync
      Parameters:
      vargs - similarity arguments
      Returns:
      list of similar element names with scores and attributes
    • expire

      public boolean expire(long timeToLive, TimeUnit timeUnit)
      Description copied from interface: RExpirable
      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
      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
    • expireAtAsync

      public RFuture<Boolean> expireAtAsync(long timestamp)
      Description copied from interface: RExpirableAsync
      Specified by:
      expireAtAsync in interface RExpirableAsync
      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
      Sets an expiration date for this 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
    • expireIfSet

      public boolean expireIfSet(Instant time)
      Description copied from interface: RExpirable
      Sets an expiration date for this object only if it has been already set. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfSet in interface RExpirable
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfSetAsync

      public RFuture<Boolean> expireIfSetAsync(Instant time)
      Description copied from interface: RExpirableAsync
      Sets an expiration date for this object only if it has been already set. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfSetAsync in interface RExpirableAsync
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfNotSet

      public boolean expireIfNotSet(Instant time)
      Description copied from interface: RExpirable
      Sets an expiration date for this object only if it hasn't been set before. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfNotSet in interface RExpirable
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfNotSetAsync

      public RFuture<Boolean> expireIfNotSetAsync(Instant time)
      Description copied from interface: RExpirableAsync
      Sets an expiration date for this object only if it hasn't been set before. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfNotSetAsync in interface RExpirableAsync
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfGreater

      public boolean expireIfGreater(Instant time)
      Description copied from interface: RExpirable
      Sets an expiration date for this object only if it's greater than expiration date set before. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfGreater in interface RExpirable
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfGreaterAsync

      public RFuture<Boolean> expireIfGreaterAsync(Instant time)
      Description copied from interface: RExpirableAsync
      Sets an expiration date for this object only if it's greater than expiration date set before. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfGreaterAsync in interface RExpirableAsync
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfLess

      public boolean expireIfLess(Instant time)
      Description copied from interface: RExpirable
      Sets an expiration date for this object only if it's less than expiration date set before. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfLess in interface RExpirable
      Parameters:
      time - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfLessAsync

      public RFuture<Boolean> expireIfLessAsync(Instant time)
      Description copied from interface: RExpirableAsync
      Sets an expiration date for this object only if it's less than expiration date set before. When expire date comes the object will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfLessAsync in interface RExpirableAsync
      Parameters:
      time - 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
    • expire

      public boolean expire(Duration duration)
      Description copied from interface: RExpirable
      Sets a timeout for this object. After the timeout has expired, the key will automatically be deleted.
      Specified by:
      expire in interface RExpirable
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireAsync

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

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

      public RFuture<Boolean> expireAtAsync(Date timestamp)
      Description copied from interface: RExpirableAsync
      Specified by:
      expireAtAsync in interface RExpirableAsync
      Parameters:
      timestamp - - expire date
      Returns:
      true if the timeout was set and false if not
    • expireIfSet

      public boolean expireIfSet(Duration duration)
      Description copied from interface: RExpirable
      Sets a timeout for this object only if it has been already set. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfSet in interface RExpirable
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfSetAsync

      public RFuture<Boolean> expireIfSetAsync(Duration duration)
      Description copied from interface: RExpirableAsync
      Sets a timeout for this object only if it has been already set. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfSetAsync in interface RExpirableAsync
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfNotSet

      public boolean expireIfNotSet(Duration duration)
      Description copied from interface: RExpirable
      Sets a timeout for this object only if it hasn't been set before. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfNotSet in interface RExpirable
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfNotSetAsync

      public RFuture<Boolean> expireIfNotSetAsync(Duration duration)
      Description copied from interface: RExpirableAsync
      Sets a timeout for this object only if it hasn't been set before. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfNotSetAsync in interface RExpirableAsync
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfGreater

      public boolean expireIfGreater(Duration duration)
      Description copied from interface: RExpirable
      Sets a timeout for this object only if it's greater than timeout set before. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfGreater in interface RExpirable
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfGreaterAsync

      public RFuture<Boolean> expireIfGreaterAsync(Duration duration)
      Description copied from interface: RExpirableAsync
      Sets a timeout for this object only if it's greater than timeout set before. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfGreaterAsync in interface RExpirableAsync
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfLess

      public boolean expireIfLess(Duration duration)
      Description copied from interface: RExpirable
      Sets a timeout for this object only if it's less than timeout set before. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfLess in interface RExpirable
      Parameters:
      duration - timeout before object will be deleted
      Returns:
      true if the timeout was set and false if not
    • expireIfLessAsync

      public RFuture<Boolean> expireIfLessAsync(Duration duration)
      Description copied from interface: RExpirableAsync
      Sets a timeout for this object only if it's less than timeout set before. After the timeout has expired, the key will automatically be deleted.

      Requires Redis 7.0.0 and higher.

      Specified by:
      expireIfLessAsync in interface RExpirableAsync
      Parameters:
      duration - timeout before object will be deleted
      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
      Returns remaining time of the object in milliseconds.
      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
      Returns remaining time of the object in milliseconds.
      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.
    • getExpireTime

      public long getExpireTime()
      Description copied from interface: RExpirable
      Returns expiration time of the object as the absolute Unix expiration timestamp in milliseconds.

      Requires Redis 7.0.0 and higher.

      Specified by:
      getExpireTime in interface RExpirable
      Returns:
      Unix time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expiration time.
    • getExpireTimeAsync

      public RFuture<Long> getExpireTimeAsync()
      Description copied from interface: RExpirableAsync
      Returns expiration time of the object as the absolute Unix expiration timestamp in milliseconds.

      Requires Redis 7.0.0 and higher.

      Specified by:
      getExpireTimeAsync in interface RExpirableAsync
      Returns:
      Unix time in milliseconds -2 if the key does not exist. -1 if the key exists but has no associated expiration time.
    • expireAsync

      protected RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit, String param, String... keys)
    • expireAtAsync

      protected RFuture<Boolean> expireAtAsync(long timestamp, String param, String... keys)
    • clearExpireAsync

      protected RFuture<Boolean> clearExpireAsync(String... keys)