Interface AerospikeOperations

All Known Implementing Classes:
AerospikeTemplate

public interface AerospikeOperations
Aerospike specific data access operations.
Author:
Oliver Gierke, Peter Milne, Anastasiia Smirnova, Roman Terentiev
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    add(T document, String binName, long value)
    Find an existing record matching the document's class and id, add specified value to the record's bin and return the modified record mapped to the document's class.
    <T> T
    add(T document, String setName, String binName, long value)
    Find an existing record matching the document's id and the given set name, add specified value to the record's bin and return the modified record mapped to the document's class.
    <T> T
    add(T document, String setName, Map<String,Long> values)
    Find an existing record matching the document's id and the given set name, add map values to the corresponding bins of the record and return the modified record mapped to the document's class.
    <T> T
    add(T document, Map<String,Long> values)
    Find an existing record matching the document's class and id, add map values to the corresponding bins of the record and return the modified record mapped to the document's class.
    <T> com.aerospike.client.query.ResultSet
    aggregate(com.aerospike.client.query.Filter filter, Class<T> entityClass, String module, String function, List<com.aerospike.client.Value> arguments)
    Execute query, apply statement's aggregation function, and return result iterator.
    com.aerospike.client.query.ResultSet
    aggregate(com.aerospike.client.query.Filter filter, String setName, String module, String function, List<com.aerospike.client.Value> arguments)
    Execute query within the given set, apply statement's aggregation function, and return result iterator.
    <T> T
    append(T document, String binName, String value)
    Find an existing record matching the document's class and id, append specified value to the record's bin and return the modified record mapped to the document's class.
    <T> T
    append(T document, String setName, String binName, String value)
    Find an existing record matching the document's id and the given set name, append specified value to the record's bin and return the modified record mapped to the document's class.
    <T> T
    append(T document, String setName, Map<String,String> values)
    Find an existing record matching the document's id and the given set name, append map values to the corresponding bins of the record and return the modified record mapped to the document's class.
    <T> T
    append(T document, Map<String,String> values)
    Find an existing record matching the document's class and id, append map values to the corresponding bins of the record and return the modified record mapped to the document's class.
    <T> long
    count(Class<T> entityClass)
    Return the amount of records in the set determined by the given entityClass.
    long
    count(String setName)
    Return the amount of records in the given Aerospike set.
    <T> long
    count(Query query, Class<T> entityClass)
    Return the amount of records in query results.
    long
    count(Query query, String setName)
    Return the amount of records in query results within the given set.
    <T> void
    createIndex(Class<T> entityClass, String indexName, String binName, com.aerospike.client.query.IndexType indexType)
    Create an index with the specified name in Aerospike.
    <T> void
    createIndex(Class<T> entityClass, String indexName, String binName, com.aerospike.client.query.IndexType indexType, com.aerospike.client.query.IndexCollectionType indexCollectionType)
    Create an index with the specified name in Aerospike.
    <T> void
    createIndex(Class<T> entityClass, String indexName, String binName, com.aerospike.client.query.IndexType indexType, com.aerospike.client.query.IndexCollectionType indexCollectionType, com.aerospike.client.cdt.CTX... ctx)
    Create an index with the specified name in Aerospike.
    void
    createIndex(String setName, String indexName, String binName, com.aerospike.client.query.IndexType indexType)
    Create an index with the specified name in Aerospike.
    void
    createIndex(String setName, String indexName, String binName, com.aerospike.client.query.IndexType indexType, com.aerospike.client.query.IndexCollectionType indexCollectionType)
    Create an index with the specified name in Aerospike.
    void
    createIndex(String setName, String indexName, String binName, com.aerospike.client.query.IndexType indexType, com.aerospike.client.query.IndexCollectionType indexCollectionType, com.aerospike.client.cdt.CTX... ctx)
    Create an index with the specified name in Aerospike.
    <T> void
    delete(Class<T> entityClass)
    Deprecated.
    since 4.6.0, use deleteAll(Class) instead.
    <T> boolean
    delete(Object id, Class<T> entityClass)
    Deprecated.
    since 4.6.0, use deleteById(Object, Class) instead.
    <T> boolean
    delete(T document)
    Delete a record using the document's id.
    <T> boolean
    delete(T document, String setName)
    Delete a record within the given set using the document's id.
    <T> void
    deleteAll(Class<T> entityClass)
    Truncate/Delete all records in the set determined by the given entity class.
    <T> void
    deleteAll(Class<T> entityClass, Instant beforeLastUpdate)
    Truncate/Delete all documents in the given set.
    <T> void
    deleteAll(Iterable<T> documents)
    Delete multiple records in one batch request.
    <T> void
    deleteAll(Iterable<T> documents, String setName)
    Delete multiple records within the given set (overrides the default set associated with the documents) in one batch request.
    void
    deleteAll(String setName)
    Truncate/Delete all documents in the given set.
    void
    deleteAll(String setName, Instant beforeLastUpdate)
    Truncate/Delete all documents in the given set.
    <T> boolean
    deleteById(Object id, Class<T> entityClass)
    Delete a record by id, set name will be determined by the given entityClass.
    boolean
    deleteById(Object id, String setName)
    Delete a record by id within the given set.
    <T> void
    deleteByIds(Iterable<?> ids, Class<T> entityClass)
    Delete records by ids using a single batch delete operation, set name will be determined by the given entityClass.
    void
    deleteByIds(Iterable<?> ids, String setName)
    Delete records by ids within the given set using a single batch delete operation.
    void
    deleteByIds(GroupedKeys groupedKeys)
    Perform a single batch delete operation for records from different sets.
    <T> void
    deleteIndex(Class<T> entityClass, String indexName)
    Delete an index with the specified name in Aerospike.
    void
    deleteIndex(String setName, String indexName)
    Delete an index with the specified name within the given set in Aerospike.
    <T> T
    execute(Supplier<T> supplier)
    Execute an operation against underlying store.
    <T> boolean
    exists(Object id, Class<T> entityClass)
    Check by id if a record exists within the set associated with the given entityClass.
    boolean
    exists(Object id, String setName)
    Check by id if a record exists within the given set name.
    <T> boolean
    existsByQuery(Query query, Class<T> entityClass)
    Check using a query if any matching records exist within the set associated with the given entityClass.
    <T> boolean
    existsByQuery(Query query, Class<T> entityClass, String setName)
    Check using a query if any matching records exist within the given set.
    <T> Stream<T>
    find(Query query, Class<T> entityClass)
    Find records in the given entityClass's set using a query and map them to the given class type.
    <T, S> Stream<S>
    find(Query query, Class<T> entityClass, Class<S> targetClass)
    Find records in the given entityClass's set using a query and map them to the given target class type.
    <T> Stream<T>
    find(Query query, Class<T> targetClass, String setName)
    Find records in the given set using a query and map them to the given target class type.
    <T> Stream<T>
    findAll(Class<T> entityClass)
    Find all records in the given entityClass's set and map them to the given class type.
    <T, S> Stream<S>
    findAll(Class<T> entityClass, Class<S> targetClass)
    Find all records in the given entityClass's set and map them to the given target class type.
    <T> Stream<T>
    findAll(Class<T> targetClass, String setName)
    Find all records in the given set and map them to the given class type.
    <T> Stream<T>
    findAll(Sort sort, long offset, long limit, Class<T> entityClass)
    Find all records in the given entityClass's set using a provided sort and map them to the given class type.
    <T, S> Stream<S>
    findAll(Sort sort, long offset, long limit, Class<T> entityClass, Class<S> targetClass)
    Find all records in the given entityClass's set using a provided sort and map them to the given target class type.
    <T> Stream<T>
    findAll(Sort sort, long offset, long limit, Class<T> targetClass, String setName)
    Find all records in the given set using a provided sort and map them to the given target class type.
    <T> T
    findById(Object id, Class<T> entityClass)
    Find a record by id, set name will be determined by the given entityClass.
    <T, S> S
    findById(Object id, Class<T> entityClass, Class<S> targetClass)
    Find a record by id, set name will be determined by the given entityClass.
    <T, S> S
    findById(Object id, Class<T> entityClass, Class<S> targetClass, String setName)
    Find a record by id within the given set.
    <T> T
    findById(Object id, Class<T> entityClass, String setName)
    Find a record by id within the given set.
    <T> List<T>
    findByIds(Iterable<?> ids, Class<T> entityClass)
    Find records by ids using a single batch read operation, set name will be determined by the given entityClass.
    <T, S> List<S>
    findByIds(Iterable<?> ids, Class<T> entityClass, Class<S> targetClass)
    Find records by ids using a single batch read operation, set name will be determined by the given entityClass.
    <T, S> List<S>
    findByIds(Iterable<?> ids, Class<T> entityClass, Class<S> targetClass, String setName)
    Find records by ids within the given set using a single batch read operation.
    <T> List<T>
    findByIds(Iterable<?> ids, Class<T> entityClass, String setName)
    Find records by ids within the given set using a single batch read operation.
    findByIds(GroupedKeys groupedKeys)
    Execute a single batch request to find several records, possibly from different sets.
    <T, S> List<?>
    findByIdsUsingQuery(Collection<?> ids, Class<T> entityClass, Class<S> targetClass, String setName, Query query)
    Find records by ids within the given set.
    <T, S> List<?>
    findByIdsUsingQuery(Collection<?> ids, Class<T> entityClass, Class<S> targetClass, Query query)
    Find records by ids and a query, set name will be determined by the given entityClass.
    <T, S> Object
    findByIdUsingQuery(Object id, Class<T> entityClass, Class<S> targetClass, String setName, Query query)
    Find a record by id within the given set using a query.
    <T, S> Object
    findByIdUsingQuery(Object id, Class<T> entityClass, Class<S> targetClass, Query query)
    Find a record by id using a query, set name will be determined by the given entityClass.
    <T> Stream<T>
    findInRange(long offset, long limit, Sort sort, Class<T> entityClass)
    Find records in the given entityClass's set using a range (offset, limit) and a sort and map them to the given class type.
    <T, S> Stream<S>
    findInRange(long offset, long limit, Sort sort, Class<T> entityClass, Class<S> targetClass)
    Find records in the given entityClass's set using a range (offset, limit) and a sort and map them to the given target class type.
    <T> Stream<T>
    findInRange(long offset, long limit, Sort sort, Class<T> targetClass, String setName)
    Find records in the given set using a range (offset, limit) and a sort and map them to the given target class type.
    <T, S> Stream<S>
    findUsingQueryWithoutPostProcessing(Class<T> entityClass, Class<S> targetClass, Query query)
    Find records in the given entityClass set using a query and map them to the given target class type.
    com.aerospike.client.IAerospikeClient
     
     
     
    long
     
    <T> String
    getSetName(Class<T> entityClass)
    Return set name used for the given entityClass in the namespace configured for the AerospikeTemplate in use.
    <T> String
    getSetName(T document)
    Return set name used for the given document in the namespace configured for the AerospikeTemplate in use.
    boolean
    indexExists(String indexName)
    Check whether an index with the specified name exists in Aerospike.
    <T> void
    insert(T document)
    Insert a document using RecordExistsAction.CREATE_ONLY policy.
    <T> void
    insert(T document, String setName)
    Insert a document within the given set (overrides the set associated with the document) using RecordExistsAction.CREATE_ONLY policy.
    <T> void
    insertAll(Iterable<? extends T> documents)
    Insert multiple documents in one batch request.
    <T> void
    insertAll(Iterable<? extends T> documents, String setName)
    Insert multiple documents within the given set (overrides the set associated with the document) in one batch request.
    <T> void
    persist(T document, com.aerospike.client.policy.WritePolicy writePolicy)
    Persist a document using specified WritePolicy.
    <T> void
    persist(T document, com.aerospike.client.policy.WritePolicy writePolicy, String setName)
    Persist a document within the given set (overrides the default set associated with the document) using specified WritePolicy.
    <T> T
    prepend(T document, String binName, String value)
    Find an existing record matching the document's class and id, prepend specified value to the record's bin and return the modified record mapped to the document's class.
    <T> T
    prepend(T document, String setName, String binName, String value)
    Find an existing record matching the document's id and the given set name, prepend specified value to the record's bin and return the modified record mapped to the document's class.
    <T> T
    prepend(T document, String setName, Map<String,String> values)
    Find an existing record matching the document's id and the given set name, prepend map values to the corresponding bins of the record and return the modified record mapped to the document's class.
    <T> T
    prepend(T document, Map<String,String> values)
    Find an existing record matching the document's class and id, prepend map values to the corresponding bins of the record and return the modified record mapped to the document's class.
    <T> void
    save(T document)
    Save a document.
    <T> void
    save(T document, String setName)
    Save a document within the given set (overrides the set associated with the document)
    <T> void
    saveAll(Iterable<T> documents)
    Save multiple documents in one batch request.
    <T> void
    saveAll(Iterable<T> documents, String setName)
    Save multiple documents within the given set (overrides the default set associated with the documents) in one batch request.
    <T> void
    update(T document)
    Update a record using RecordExistsAction.UPDATE_ONLY policy combined with removing bins at first (analogous to RecordExistsAction.REPLACE_ONLY) taking into consideration the version property of the document if it is present.
    <T> void
    update(T document, String setName)
    Update a record with the given set (overrides the set associated with the document) using RecordExistsAction.UPDATE_ONLY policy combined with removing bins at first (analogous to RecordExistsAction.REPLACE_ONLY) taking into consideration the version property of the document if it is present.
    <T> void
    update(T document, String setName, Collection<String> fields)
    Update specific fields of a record based on the given collection of fields with the given set (overrides the set associated with the document) using RecordExistsAction.UPDATE_ONLY policy.
    <T> void
    update(T document, Collection<String> fields)
    Update specific fields of a record based on the given collection of fields using RecordExistsAction.UPDATE_ONLY policy.
    <T> void
    updateAll(Iterable<T> documents)
    Update multiple records in one batch request.
    <T> void
    updateAll(Iterable<T> documents, String setName)
    Update multiple records within the given set (overrides the default set associated with the documents) in one batch request.
  • Method Details

    • getSetName

      <T> String getSetName(Class<T> entityClass)
      Return set name used for the given entityClass in the namespace configured for the AerospikeTemplate in use.
      Parameters:
      entityClass - The class to get the set name for.
      Returns:
      The set name used for the given entityClass.
    • getSetName

      <T> String getSetName(T document)
      Return set name used for the given document in the namespace configured for the AerospikeTemplate in use.
      Parameters:
      document - The document to get the set name for.
      Returns:
      The set name used for the given document.
    • getMappingContext

      MappingContext<?,?> getMappingContext()
      Returns:
      Mapping context in use.
    • getAerospikeConverter

      MappingAerospikeConverter getAerospikeConverter()
      Returns:
      converter in use.
    • getAerospikeClient

      com.aerospike.client.IAerospikeClient getAerospikeClient()
      Returns:
      Aerospike client in use.
    • getQueryMaxRecords

      long getQueryMaxRecords()
      Returns:
      Value of configuration parameter
      invalid reference
      AerospikeDataSettings#getQueryMaxRecords()
      .
    • save

      <T> void save(T document)
      Save a document.

      If the document has version property, CAS algorithm is used for updating record. Version property is used for deciding whether to create a new record or update an existing one. If the version is set to zero, a new record will be created, creation will fail if such record already exists. If the version is greater than zero, existing record will be updated with RecordExistsAction.UPDATE_ONLY policy combined with removing bins at first (analogous to RecordExistsAction.REPLACE_ONLY) taking into consideration the version property of the document. Document's version property will be updated with the server's version after successful operation.

      If the document does not have version property, record is updated with RecordExistsAction.UPDATE policy combined with removing bins at first (analogous to RecordExistsAction.REPLACE). This means that when such record does not exist it will be created, otherwise updated (an "upsert").

      Parameters:
      document - The document to be saved. Must not be null.
      Throws:
      OptimisticLockingFailureException - if the document has a version attribute with a different value from that found on server.
      DataAccessException - If operation failed (see DefaultAerospikeExceptionTranslator for details).
    • save

      <T> void save(T document, String setName)
      Save a document within the given set (overrides the set associated with the document)

      If the document has version property, CAS algorithm is used for updating record. Version property is used for deciding whether to create a new record or update an existing one. If the version is set to zero, a new record will be created, creation will fail if such record already exists. If the version is greater than zero, existing record will be updated with RecordExistsAction.UPDATE_ONLY policy combined with removing bins at first (analogous to RecordExistsAction.REPLACE_ONLY) taking into consideration the version property of the document. Document's version property will be updated with the server's version after successful operation.

      If the document does not have version property, record is updated with RecordExistsAction.UPDATE policy combined with removing bins at first (analogous to RecordExistsAction.REPLACE). This means that when such record does not exist it will be created, otherwise updated (an "upsert").

      Parameters:
      document - The document to be saved. Must not be null.
      setName - Set name to override the set associated with the document.
      Throws:
      OptimisticLockingFailureException - if the document has a version attribute with a different value from that found on server.
      DataAccessException - If operation failed (see DefaultAerospikeExceptionTranslator for details).
    • saveAll

      <T> void saveAll(Iterable<T> documents)
      Save multiple documents in one batch request. The policies are analogous to save(Object).

      The order of returned results is preserved. The execution order is NOT preserved.

      This operation requires Server version 6.0+.

      Parameters:
      documents - The documents to be saved. Must not be null.
      Throws:
      com.aerospike.client.AerospikeException.BatchRecordArray - If batch save succeeds, but results contain errors or null records.
      OptimisticLockingFailureException - If at least one document has a version attribute with a different value from that found on server.
      DataAccessException - If batch operation failed (see DefaultAerospikeExceptionTranslator for details).
    • saveAll

      <T> void saveAll(Iterable<T> documents, String setName)
      Save multiple documents within the given set (overrides the default set associated with the documents) in one batch request. The policies are analogous to save(Object).

      The order of returned results is preserved. The execution order is NOT preserved.

      This operation requires Server version 6.0+.

      Parameters:
      documents - The documents to be saved. Must not be null.
      setName - Set name to override the default set associated with the documents.
      Throws:
      com.aerospike.client.AerospikeException.BatchRecordArray - If batch save succeeds, but results contain errors or null records.
      OptimisticLockingFailureException - If at least one document has a version attribute with a different value from that found on server.
      DataAccessException - If batch operation failed (see DefaultAerospikeExceptionTranslator for details).
    • insert

      <T> void insert(T document)
      Insert a document using RecordExistsAction.CREATE_ONLY policy.

      If the document has version property it will be updated with the server's version after successful operation.

      Parameters:
      document - The document to be inserted. Must not be null.
      Throws:
      OptimisticLockingFailureException - if the document has a version attribute with a different value from that found on server.
      DataAccessException - If batch operation failed (see DefaultAerospikeExceptionTranslator for details).
    • insert

      <T> void insert(T document, String setName)
      Insert a document within the given set (overrides the set associated with the document) using RecordExistsAction.CREATE_ONLY policy.

      If document has version property, it will be updated with the server's version after successful operation.

      Parameters:
      document - The document to be inserted. Must not be null.
      setName - Set name to override the set associated with the document.
      Throws:
      OptimisticLockingFailureException - if the document has a version attribute with a different value from that found on server.
      DataAccessException - If batch operation failed (see DefaultAerospikeExceptionTranslator for details).
    • insertAll

      <T> void insertAll(Iterable<? extends T> documents)
      Insert multiple documents in one batch request. The policies are analogous to insert(Object).

      The order of returned results is preserved. The execution order is NOT preserved.

      This operation requires Server version 6.0+.

      Parameters:
      documents - Documents to be inserted. Must not be null.
      Throws:
      com.aerospike.client.AerospikeException.BatchRecordArray - If batch insert succeeds, but results contain errors or null records.
      OptimisticLockingFailureException - If at least one document has a version attribute with a different value from that found on server.
      DataAccessException - If batch operation failed (see DefaultAerospikeExceptionTranslator for details).
    • insertAll

      <T> void insertAll(Iterable<? extends T> documents, String setName)
      Insert multiple documents within the given set (overrides the set associated with the document) in one batch request. The policies are analogous to insert(Object).

      The order of returned results is preserved. The execution order is NOT preserved.

      This operation requires Server version 6.0+.

      Parameters:
      documents - Documents to be inserted. Must not be null.
      setName - Set name to override the set associated with the document.
      Throws:
      com.aerospike.client.AerospikeException.BatchRecordArray - If batch insert succeeds, but results contain errors or null records.
      OptimisticLockingFailureException - If at least one document has a version attribute with a different value from that found on server.
      DataAccessException - If batch operation failed (see DefaultAerospikeExceptionTranslator for details).
    • persist

      <T> void persist(T document, com.aerospike.client.policy.WritePolicy writePolicy)
      Persist a document using specified WritePolicy.
      Parameters:
      document - The document to be persisted. Must not be null.
      writePolicy - The Aerospike write policy for the inner Aerospike put operation. Must not be null.
      Throws:
      DataAccessException - If operation failed (see DefaultAerospikeExceptionTranslator for details).
    • persist

      <T> void persist(T document, com.aerospike.client.policy.WritePolicy writePolicy, String setName)
      Persist a document within the given set (overrides the default set associated with the document) using specified WritePolicy.
      Parameters:
      document - The document to be persisted. Must not be null.
      writePolicy - The Aerospike write policy for the inner Aerospike put operation. Must not be null.
      setName - Set name to override the set associated with the document.
      Throws:
      DataAccessException - If operation failed (see DefaultAerospikeExceptionTranslator for details).
    • update

      <T> void update(T document)
      Update a record using RecordExistsAction.UPDATE_ONLY policy combined with removing bins at first (analogous to RecordExistsAction.REPLACE_ONLY) taking into consideration the version property of the document if it is present.

      If document has version property it will be updated with the server's version after successful operation.

      Parameters:
      document - The document that identifies the record to be updated. Must not be null.
      Throws:
      OptimisticLockingFailureException - if the document has a version attribute with a different value from that found on server.
      DataAccessException - If operation failed (see DefaultAerospikeExceptionTranslator for details).
    • update

      <T> void update(T document, String setName)
      Update a record with the given set (overrides the set associated with the document) using RecordExistsAction.UPDATE_ONLY policy combined with removing bins at first (analogous to RecordExistsAction.REPLACE_ONLY) taking into consideration the version property of the document if it is present.

      If document has version property it will be updated with the server's version after successful operation.

      Parameters:
      document - The document that identifies the record to be updated. Must not be null.
      setName - Set name to override the set associated with the document.
      Throws:
      OptimisticLockingFailureException - if the document has a version attribute with a different value from that found on server.
      DataAccessException - If operation failed (see DefaultAerospikeExceptionTranslator for details).
    • update

      <T> void update(T document, Collection<String> fields)
      Update specific fields of a record based on the given collection of fields using RecordExistsAction.UPDATE_ONLY policy. You can instantiate the document with only the relevant fields and specify the list of fields that you want to update. Taking into consideration the version property of the document if it is present.

      If document has version property it will be updated with the server's version after successful operation.

      Parameters:
      document - The document that identifies the record to be updated. Must not be null.
      fields - Specific fields to update.
      Throws:
      OptimisticLockingFailureException - if the document has a version attribute with a different value from that found on server.
      DataAccessException - If operation failed (see DefaultAerospikeExceptionTranslator for details).
    • update

      <T> void update(T document, String setName, Collection<String> fields)
      Update specific fields of a record based on the given collection of fields with the given set (overrides the set associated with the document) using RecordExistsAction.UPDATE_ONLY policy. You can instantiate the document with only the relevant fields and specify the list of fields that you want to update. Taking into consideration the version property of the document if it is present.

      If document has version property it will be updated with the server's version after successful operation.

      Parameters:
      document - The document that identifies the record to be updated. Must not be null.
      setName - Set name to override the set associated with the document.
      fields - Specific fields to update.
      Throws:
      OptimisticLockingFailureException - if the document has a version attribute with a different value from that found on server.
      DataAccessException - If operation failed (see DefaultAerospikeExceptionTranslator for details).
    • updateAll

      <T> void updateAll(Iterable<T> documents)
      Update multiple records in one batch request. The policies are analogous to update(Object).

      The order of returned results is preserved. The execution order is NOT preserved.

      This operation requires Server version 6.0+.

      Parameters:
      documents - The documents that identify the records to be updated. Must not be null.
      Throws:
      com.aerospike.client.AerospikeException.BatchRecordArray - If batch update succeeds, but results contain errors or null records.
      OptimisticLockingFailureException - If at least one document has a version attribute with a different value from that found on server.
      DataAccessException - If batch operation failed (see DefaultAerospikeExceptionTranslator for details).
    • updateAll

      <T> void updateAll(Iterable<T> documents, String setName)
      Update multiple records within the given set (overrides the default set associated with the documents) in one batch request. The policies are analogous to update(Object).

      The order of returned results is preserved. The execution order is NOT preserved.

      This operation requires Server version 6.0+.

      Parameters:
      documents - The documents that identify the records to be updated. Must not be null.
      setName - Set name to override the set associated with the document.
      Throws:
      com.aerospike.client.AerospikeException.BatchRecordArray - If batch update succeeds, but results contain errors or null records.
      OptimisticLockingFailureException - If at least one document has a version attribute with a different value from that found on server.
      DataAccessException - If batch operation failed (see DefaultAerospikeExceptionTranslator for details).
    • delete

      <T> void delete(Class<T> entityClass)
      Deprecated.
      since 4.6.0, use deleteAll(Class) instead.
      Truncate/Delete all records in the set determined by the given entityClass.
      Parameters:
      entityClass - The class to extract set name from. Must not be null.
    • delete

      <T> boolean delete(Object id, Class<T> entityClass)
      Deprecated.
      since 4.6.0, use deleteById(Object, Class) instead.
      Delete a record by id, set name will be determined by the given entityClass.
      Parameters:
      id - The id of the record to delete. Must not be null.
      entityClass - The class to extract set name from. Must not be null.
      Returns:
      whether the record existed on server before deletion.
    • delete

      <T> boolean delete(T document)
      Delete a record using the document's id.

      If the document has version property it will be compared with the corresponding record's version on server.

      Parameters:
      document - The document to get set name and id from. Must not be null.
      Returns:
      Whether the record existed on server before deletion.
      Throws:
      OptimisticLockingFailureException - if the document has a version attribute with a different value from that found on server.
      DataAccessException - If operation failed (see DefaultAerospikeExceptionTranslator for details).
    • delete

      <T> boolean delete(T document, String setName)
      Delete a record within the given set using the document's id.

      If the document has version property it will be compared with the corresponding record's version on server.

      Parameters:
      document - The document to get id from. Must not be null.
      setName - Set name to use.
      Returns:
      Whether the record existed on server before deletion.
      Throws:
      OptimisticLockingFailureException - if the document has a version attribute with a different value from that found on server.
      DataAccessException - If operation failed (see DefaultAerospikeExceptionTranslator for details).
    • deleteAll

      <T> void deleteAll(Iterable<T> documents)
      Delete multiple records in one batch request. The policies are analogous to delete(Object).

      The execution order is NOT preserved.

      This operation requires Server version 6.0+.

      Parameters:
      documents - The documents to be deleted. Must not be null.
      Throws:
      com.aerospike.client.AerospikeException.BatchRecordArray - If batch save succeeds, but results contain errors or null records.
      OptimisticLockingFailureException - If at least one document has a version attribute with a different value from that found on server.
      DataAccessException - If batch operation failed (see DefaultAerospikeExceptionTranslator for details).
    • deleteAll

      <T> void deleteAll(Iterable<T> documents, String setName)
      Delete multiple records within the given set (overrides the default set associated with the documents) in one batch request. The policies are analogous to delete(Object).

      The execution order is NOT preserved.

      This operation requires Server version 6.0+.

      Parameters:
      documents - The documents to be deleted. Must not be null.
      setName - Set name to override the default set associated with the documents.
      Throws:
      com.aerospike.client.AerospikeException.BatchRecordArray - If batch delete results contain errors.
      OptimisticLockingFailureException - If at least one document has a version attribute with a different value from that found on server.
      DataAccessException - If batch operation failed (see DefaultAerospikeExceptionTranslator for details).
    • deleteById

      <T> boolean deleteById(Object id, Class<T> entityClass)
      Delete a record by id, set name will be determined by the given entityClass.

      If the document has version property it is not compared with the corresponding record's version on server.

      Parameters:
      id - The id of the record to be deleted. Must not be null.
      entityClass - The class to extract set name from. Must not be null.
      Returns:
      Whether the record existed on server before deletion.
      Throws:
      DataAccessException - If operation failed (see DefaultAerospikeExceptionTranslator for details).
    • deleteById

      boolean deleteById(Object id, String setName)
      Delete a record by id within the given set.

      If the document has version property it is not compared with the corresponding record's version on server.

      Parameters:
      id - The id of the record to be deleted. Must not be null.
      setName - Set name to use.
      Returns:
      Whether the record existed on server before deletion.
      Throws:
      DataAccessException - If operation failed (see DefaultAerospikeExceptionTranslator for details).
    • deleteByIds

      <T> void deleteByIds(Iterable<?> ids, Class<T> entityClass)
      Delete records by ids using a single batch delete operation, set name will be determined by the given entityClass. The policies are analogous to deleteById(Object, Class).

      This operation requires Server version 6.0+.

      Parameters:
      ids - The ids of the records to be deleted. Must not be null.
      entityClass - The class to extract set name from. Must not be null.
      Throws:
      com.aerospike.client.AerospikeException.BatchRecordArray - If batch delete results contain errors.
      DataAccessException - If batch operation failed (see DefaultAerospikeExceptionTranslator for details).
    • deleteByIds

      void deleteByIds(Iterable<?> ids, String setName)
      Delete records by ids within the given set using a single batch delete operation. The policies are analogous to deleteById(Object, String).

      This operation requires Server version 6.0+.

      Parameters:
      ids - The ids of the records to be deleted. Must not be null.
      setName - Set name to use.
      Throws:
      com.aerospike.client.AerospikeException.BatchRecordArray - If batch delete results contain errors.
      DataAccessException - If batch operation failed (see DefaultAerospikeExceptionTranslator for details).
    • deleteByIds

      void deleteByIds(GroupedKeys groupedKeys)
      Perform a single batch delete operation for records from different sets.

      Records' versions on server are not checked.

      This operation requires Server 6.0+.

      Parameters:
      groupedKeys - Keys grouped by document type. Must not be null, groupedKeys.getEntitiesKeys() must not be null.
      Throws:
      com.aerospike.client.AerospikeException.BatchRecordArray - If batch delete results contain errors.
      DataAccessException - If batch operation failed (see DefaultAerospikeExceptionTranslator for details).
    • deleteAll

      <T> void deleteAll(Class<T> entityClass)
      Truncate/Delete all records in the set determined by the given entity class.
      Parameters:
      entityClass - The class to extract set name from. Must not be null.
      Throws:
      DataAccessException - If operation failed (see DefaultAerospikeExceptionTranslator for details).
    • deleteAll

      <T> void deleteAll(Class<T> entityClass, Instant beforeLastUpdate)
      Truncate/Delete all documents in the given set.
      Parameters:
      entityClass - The class to extract set name from. Must not be null.
      beforeLastUpdate - Delete records before the specified time (must be earlier than the current time at millisecond resolution).
      Throws:
      DataAccessException - If operation failed (see DefaultAerospikeExceptionTranslator for details).
    • deleteAll

      void deleteAll(String setName)
      Truncate/Delete all documents in the given set.
      Parameters:
      setName - Set name to truncate/delete all records in.
      Throws:
      DataAccessException - If operation failed (see DefaultAerospikeExceptionTranslator for details).
    • deleteAll

      void deleteAll(String setName, Instant beforeLastUpdate)
      Truncate/Delete all documents in the given set.
      Parameters:
      setName - Set name to truncate/delete all records in.
      beforeLastUpdate - Delete records before the specified time (must be earlier than the current time at millisecond resolution).
      Throws:
      DataAccessException - If operation failed (see DefaultAerospikeExceptionTranslator for details).
    • add

      <T> T add(T document, Map<String,Long> values)
      Find an existing record matching the document's class and id, add map values to the corresponding bins of the record and return the modified record mapped to the document's class.
      Parameters:
      document - The document to get set name and id from and to map the record to. Must not be null.
      values - The Map of bin names and values to add. Must not be null.
      Returns:
      Modified record mapped to the document's class.
    • add

      <T> T add(T document, String setName, Map<String,Long> values)
      Find an existing record matching the document's id and the given set name, add map values to the corresponding bins of the record and return the modified record mapped to the document's class.
      Parameters:
      document - The document to get id from and to map the record to. Must not be null.
      setName - Set name to use.
      values - The Map of bin names and values to add. Must not be null.
      Returns:
      Modified record mapped to the document's class.
    • add

      <T> T add(T document, String binName, long value)
      Find an existing record matching the document's class and id, add specified value to the record's bin and return the modified record mapped to the document's class.
      Parameters:
      document - The document to get set name and id from and to map the record to. Must not be null.
      binName - Bin name to use add operation on. Must not be null.
      value - The value to add.
      Returns:
      Modified record mapped to the document's class.
    • add

      <T> T add(T document, String setName, String binName, long value)
      Find an existing record matching the document's id and the given set name, add specified value to the record's bin and return the modified record mapped to the document's class.
      Parameters:
      document - The document to get id from and to map the record to. Must not be null.
      setName - Set name to use.
      binName - Bin name to use add operation on. Must not be null.
      value - The value to add.
      Returns:
      Modified record mapped to the document's class.
    • append

      <T> T append(T document, Map<String,String> values)
      Find an existing record matching the document's class and id, append map values to the corresponding bins of the record and return the modified record mapped to the document's class.
      Parameters:
      document - The document to get set name and id from and to map the record to. Must not be null.
      values - The Map of bin names and values to append. Must not be null.
      Returns:
      Modified record mapped to the document's class.
    • append

      <T> T append(T document, String setName, Map<String,String> values)
      Find an existing record matching the document's id and the given set name, append map values to the corresponding bins of the record and return the modified record mapped to the document's class.
      Parameters:
      document - The document to get id from and to map the record to. Must not be null.
      setName - Set name to use.
      values - The Map of bin names and values to append. Must not be null.
      Returns:
      Modified record mapped to the document's class.
    • append

      <T> T append(T document, String binName, String value)
      Find an existing record matching the document's class and id, append specified value to the record's bin and return the modified record mapped to the document's class.
      Parameters:
      document - The document to get set name and id from and to map the record to. Must not be null.
      binName - Bin name to use append operation on.
      value - The value to append.
      Returns:
      Modified record mapped to the document's class.
    • append

      <T> T append(T document, String setName, String binName, String value)
      Find an existing record matching the document's id and the given set name, append specified value to the record's bin and return the modified record mapped to the document's class.
      Parameters:
      document - The document to get id from and to map the record to. Must not be null.
      setName - Set name to use.
      binName - Bin name to use append operation on.
      value - The value to append.
      Returns:
      Modified record mapped to the document's class.
    • prepend

      <T> T prepend(T document, Map<String,String> values)
      Find an existing record matching the document's class and id, prepend map values to the corresponding bins of the record and return the modified record mapped to the document's class.
      Parameters:
      document - The document to get set name and id from and to map the record to. Must not be null.
      values - The Map of bin names and values to prepend. Must not be null.
      Returns:
      Modified record mapped to the document's class.
    • prepend

      <T> T prepend(T document, String setName, Map<String,String> values)
      Find an existing record matching the document's id and the given set name, prepend map values to the corresponding bins of the record and return the modified record mapped to the document's class.
      Parameters:
      document - The document to get id from and to map the record to. Must not be null.
      setName - Set name to use.
      values - The Map of bin names and values to prepend. Must not be null.
      Returns:
      Modified record mapped to the document's class.
    • prepend

      <T> T prepend(T document, String binName, String value)
      Find an existing record matching the document's class and id, prepend specified value to the record's bin and return the modified record mapped to the document's class.
      Parameters:
      document - The document to get set name and id from and to map the record to. Must not be null.
      binName - Bin name to use prepend operation on.
      value - The value to prepend.
      Returns:
      Modified record mapped to the document's class.
    • prepend

      <T> T prepend(T document, String setName, String binName, String value)
      Find an existing record matching the document's id and the given set name, prepend specified value to the record's bin and return the modified record mapped to the document's class.
      Parameters:
      document - The document to get id from and to map the record to. Must not be null.
      setName - Set name to use.
      binName - Bin name to use prepend operation on.
      value - The value to prepend.
      Returns:
      Modified record mapped to the document's class.
    • execute

      <T> T execute(Supplier<T> supplier)
      Execute an operation against underlying store.
      Parameters:
      supplier - must not be null.
      Returns:
      The resulting document.
    • findById

      <T> T findById(Object id, Class<T> entityClass)
      Find a record by id, set name will be determined by the given entityClass.

      The matching record will be mapped to the given entityClass.

      Parameters:
      id - The id of the record to find. Must not be null.
      entityClass - The class to extract set name from and to map the record to. Must not be null.
      Returns:
      The document mapped to entityClass's type or null if nothing is found
    • findById

      <T> T findById(Object id, Class<T> entityClass, String setName)
      Find a record by id within the given set.

      The matching record will be mapped to the given entityClass.

      Parameters:
      id - The id of the record to find. Must not be null.
      entityClass - The class to map the record to and to get entity properties from (such as expiration). Must not be null.
      setName - Set name to find the document from.
      Returns:
      The record mapped to entityClass's type or null if document does not exist
    • findById

      <T, S> S findById(Object id, Class<T> entityClass, Class<S> targetClass)
      Find a record by id, set name will be determined by the given entityClass.

      The matching record will be mapped to the given entityClass.

      Parameters:
      id - The id of the record to find. Must not be null.
      entityClass - The class to extract set name from. Must not be null.
      targetClass - The class to map the record to. Must not be null.
      Returns:
      The record mapped to targetClass's type or null if document doesn't exist.
    • findById

      <T, S> S findById(Object id, Class<T> entityClass, Class<S> targetClass, String setName)
      Find a record by id within the given set.

      The matching record will be mapped to the given entityClass.

      Parameters:
      id - The id of the record to find. Must not be null.
      entityClass - The class to get entity properties from (such as expiration). Must not be null.
      targetClass - The class to map the record to. Must not be null.
      setName - Set name to find the document from.
      Returns:
      The record mapped to targetClass's type or null if document doesn't exist.
    • findByIds

      <T> List<T> findByIds(Iterable<?> ids, Class<T> entityClass)
      Find records by ids using a single batch read operation, set name will be determined by the given entityClass.

      The records will be mapped to the given entityClass.

      Parameters:
      ids - The ids of the documents to find. Must not be null.
      entityClass - The class to extract set name from and to map the records to. Must not be null.
      Returns:
      The matching records mapped to entityClass's type, if no document exists, an empty list is returned.
    • findByIds

      <T> List<T> findByIds(Iterable<?> ids, Class<T> entityClass, String setName)
      Find records by ids within the given set using a single batch read operation.

      The records will be mapped to the given entityClass.

      Parameters:
      ids - The ids of the documents to find. Must not be null.
      entityClass - The class to map the records to. Must not be null.
      setName - Set name to use.
      Returns:
      The matching records mapped to entityClass's type or an empty list if nothing found.
    • findByIds

      <T, S> List<S> findByIds(Iterable<?> ids, Class<T> entityClass, Class<S> targetClass)
      Find records by ids using a single batch read operation, set name will be determined by the given entityClass.

      The records will be mapped to the given targetClass.

      Parameters:
      ids - The ids of the documents to find. Must not be null.
      entityClass - The class to extract set name from. Must not be null.
      targetClass - The class to map the record to. Must not be null.
      Returns:
      The matching records mapped to targetClass's type or an empty list if nothing found.
    • findByIds

      <T, S> List<S> findByIds(Iterable<?> ids, Class<T> entityClass, Class<S> targetClass, String setName)
      Find records by ids within the given set using a single batch read operation.

      The records will be mapped to the given targetClass.

      Parameters:
      ids - The ids of the documents to find. Must not be null.
      entityClass - The class to get entity properties from (such as expiration). Must not be null.
      targetClass - The class to map the record to. Must not be null.
      setName - Set name to use.
      Returns:
      The matching records mapped to targetClass's type or an empty list if nothing found.
    • findByIds

      GroupedEntities findByIds(GroupedKeys groupedKeys)
      Execute a single batch request to find several records, possibly from different sets.

      Aerospike provides functionality to get records from different sets in 1 batch request. This method receives keys grouped by document type as a parameter and returns Aerospike records mapped to documents grouped by type.

      Parameters:
      groupedKeys - Keys grouped by document type. Must not be null, groupedKeys.getEntitiesKeys() must not be null.
      Returns:
      grouped documents.
    • findByIdUsingQuery

      <T, S> Object findByIdUsingQuery(Object id, Class<T> entityClass, Class<S> targetClass, @Nullable Query query)
      Find a record by id using a query, set name will be determined by the given entityClass.

      The record will be mapped to the given targetClass.

      Parameters:
      id - The id of the record to find. Must not be null.
      entityClass - The class to extract set name from. Must not be null.
      targetClass - The class to map the record to.
      query - The Query to filter results. Optional argument (null if no filtering required).
      Returns:
      The matching record mapped to targetClass's type.
    • findByIdUsingQuery

      <T, S> Object findByIdUsingQuery(Object id, Class<T> entityClass, Class<S> targetClass, String setName, @Nullable Query query)
      Find a record by id within the given set using a query.

      The record will be mapped to the given targetClass.

      Parameters:
      id - The id of the record to find. Must not be null.
      entityClass - The class to get the entity properties from (such as expiration). Must not be null.
      targetClass - The class to map the record to.
      setName - Set name to use.
      query - The Query to filter results. Optional argument (null if no filtering required).
      Returns:
      The matching record mapped to targetClass's type.
    • findByIdsUsingQuery

      <T, S> List<?> findByIdsUsingQuery(Collection<?> ids, Class<T> entityClass, Class<S> targetClass, @Nullable Query query)
      Find records by ids and a query, set name will be determined by the given entityClass.

      The records will be mapped to the given targetClass.

      Parameters:
      ids - The ids of the documents to find. Must not be null.
      entityClass - The class to extract set name from. Must not be null.
      targetClass - The class to map the record to.
      query - The Query to filter results. Optional argument (null if no filtering required).
      Returns:
      The matching records mapped to targetClass's type if provided (otherwise to entityClass's type), or an empty list if no documents found.
    • findByIdsUsingQuery

      <T, S> List<?> findByIdsUsingQuery(Collection<?> ids, Class<T> entityClass, Class<S> targetClass, String setName, @Nullable Query query)
      Find records by ids within the given set.

      The records will be mapped to the given targetClass.

      Parameters:
      ids - The ids of the documents to find. Must not be null.
      entityClass - The class to get the entity properties from (such as expiration). Must not be null.
      targetClass - The class to map the record to.
      setName - Set name to use.
      query - The Query to filter results. Optional argument (null if no filtering required).
      Returns:
      The matching records mapped to targetClass's type if provided (otherwise to entityClass's type), or an empty list if no documents found.
    • find

      <T> Stream<T> find(Query query, Class<T> entityClass)
      Find records in the given entityClass's set using a query and map them to the given class type.
      Parameters:
      query - The Query to filter results. Must not be null.
      entityClass - The class to extract set name from and to map the records to. Must not be null.
      Returns:
      A Stream of matching records mapped to entityClass type.
    • find

      <T, S> Stream<S> find(Query query, Class<T> entityClass, Class<S> targetClass)
      Find records in the given entityClass's set using a query and map them to the given target class type.
      Parameters:
      query - The Query to filter results. Must not be null.
      entityClass - The class to extract set name from. Must not be null.
      targetClass - The class to map the record to. Must not be null.
      Returns:
      A Stream of matching records mapped to targetClass type.
    • find

      <T> Stream<T> find(Query query, Class<T> targetClass, String setName)
      Find records in the given set using a query and map them to the given target class type.
      Parameters:
      query - The Query to filter results. Must not be null.
      targetClass - The class to map the record to. Must not be null.
      setName - Set name to use.
      Returns:
      A Stream of matching records mapped to targetClass type.
    • findAll

      <T> Stream<T> findAll(Class<T> entityClass)
      Find all records in the given entityClass's set and map them to the given class type.
      Parameters:
      entityClass - The class to extract set name from and to map the records to. Must not be null.
      Returns:
      A Stream of matching records mapped to entityClass type.
    • findAll

      <T, S> Stream<S> findAll(Class<T> entityClass, Class<S> targetClass)
      Find all records in the given entityClass's set and map them to the given target class type.
      Parameters:
      entityClass - The class to extract set name from. Must not be null.
      targetClass - The class to map the record to. Must not be null.
      Returns:
      A Stream of matching records mapped to targetClass type.
    • findAll

      <T> Stream<T> findAll(Class<T> targetClass, String setName)
      Find all records in the given set and map them to the given class type.
      Parameters:
      targetClass - The class to map the records to. Must not be null.
      setName - Set name to use.
      Returns:
      A Stream of matching records mapped to entityClass type.
    • findAll

      <T> Stream<T> findAll(Sort sort, long offset, long limit, Class<T> entityClass)
      Find all records in the given entityClass's set using a provided sort and map them to the given class type.
      Parameters:
      sort - The sort to affect the returned iterable documents order.
      offset - The offset to start the range from.
      limit - The limit of the range.
      entityClass - The class to extract set name from and to map the records to.
      Returns:
      A Stream of matching records mapped to entityClass type.
    • findAll

      <T, S> Stream<S> findAll(Sort sort, long offset, long limit, Class<T> entityClass, Class<S> targetClass)
      Find all records in the given entityClass's set using a provided sort and map them to the given target class type.
      Parameters:
      sort - The sort to affect the returned iterable documents order.
      offset - The offset to start the range from.
      limit - The limit of the range.
      entityClass - The class to extract set name from.
      targetClass - The class to map the record to. Must not be null.
      Returns:
      A Stream of matching records mapped to targetClass type.
    • findAll

      <T> Stream<T> findAll(Sort sort, long offset, long limit, Class<T> targetClass, String setName)
      Find all records in the given set using a provided sort and map them to the given target class type.
      Parameters:
      sort - The sort to affect the returned iterable documents order.
      offset - The offset to start the range from.
      limit - The limit of the range.
      targetClass - The class to map the record to. Must not be null.
      setName - Set name to use.
      Returns:
      A Stream of matching records mapped to targetClass type.
    • findInRange

      <T> Stream<T> findInRange(long offset, long limit, Sort sort, Class<T> entityClass)
      Find records in the given entityClass's set using a range (offset, limit) and a sort and map them to the given class type.
      Parameters:
      offset - The offset to start the range from.
      limit - The limit of the range.
      sort - The sort to affect the order of the returned Stream of documents.
      entityClass - The class to extract set name from and to map the records to. Must not be null.
      Returns:
      A Stream of matching records mapped to entityClass type.
    • findInRange

      <T, S> Stream<S> findInRange(long offset, long limit, Sort sort, Class<T> entityClass, Class<S> targetClass)
      Find records in the given entityClass's set using a range (offset, limit) and a sort and map them to the given target class type.
      Parameters:
      offset - The offset to start the range from.
      limit - The limit of the range.
      sort - The sort to affect the returned Stream of documents order.
      entityClass - The class to extract set name from. Must not be null.
      targetClass - The class to map the record to. Must not be null.
      Returns:
      A Stream of matching records mapped to targetClass type.
    • findInRange

      <T> Stream<T> findInRange(long offset, long limit, Sort sort, Class<T> targetClass, String setName)
      Find records in the given set using a range (offset, limit) and a sort and map them to the given target class type.
      Parameters:
      offset - The offset to start the range from.
      limit - The limit of the range.
      sort - The sort to affect the returned Stream of documents order.
      targetClass - The class to map the record to. Must not be null.
      setName - Set name to use.
      Returns:
      A Stream of matching records mapped to targetClass type.
    • findUsingQueryWithoutPostProcessing

      <T, S> Stream<S> findUsingQueryWithoutPostProcessing(Class<T> entityClass, Class<S> targetClass, Query query)
      Find records in the given entityClass set using a query and map them to the given target class type. If the query has pagination and/or sorting, post-processing must be applied separately.
      Parameters:
      entityClass - The class to extract set name from. Must not be null.
      targetClass - The class to map the records to.
      query - The Query to filter results.
      Returns:
      A Stream of all matching records (regardless of pagination/sorting) mapped to targetClass type.
    • exists

      <T> boolean exists(Object id, Class<T> entityClass)
      Check by id if a record exists within the set associated with the given entityClass.
      Parameters:
      id - The id to check for record existence. Must not be null.
      entityClass - The class to extract set name from. Must not be null.
      Returns:
      whether the matching record exists.
    • exists

      boolean exists(Object id, String setName)
      Check by id if a record exists within the given set name.
      Parameters:
      id - The id to check for record existence. Must not be null.
      setName - Set name to use.
      Returns:
      whether the matching record exists.
    • existsByQuery

      <T> boolean existsByQuery(Query query, Class<T> entityClass)
      Check using a query if any matching records exist within the set associated with the given entityClass.
      Parameters:
      query - The query to check if any matching records exist. Must not be null.
      entityClass - The class to extract set name from. Must not be null.
      Returns:
      whether any matching records exist.
    • existsByQuery

      <T> boolean existsByQuery(Query query, Class<T> entityClass, String setName)
      Check using a query if any matching records exist within the given set.
      Parameters:
      query - The query to check if any matching records exist. Must not be null.
      entityClass - The class to translate to returned records into. Must not be null.
      setName - Set name to use. Must not be null.
      Returns:
      whether any matching records exist.
    • count

      <T> long count(Class<T> entityClass)
      Return the amount of records in the set determined by the given entityClass.
      Parameters:
      entityClass - The class to extract set name from. Must not be null.
      Returns:
      amount of records in the set of the given entityClass.
    • count

      long count(String setName)
      Return the amount of records in the given Aerospike set.
      Parameters:
      setName - The name of the set to count. Must not be null.
      Returns:
      amount of records in the given set.
    • count

      <T> long count(Query query, Class<T> entityClass)
      Return the amount of records in query results. Set name will be determined by the given entityClass.
      Parameters:
      query - The query that provides the result set for count.
      entityClass - The class to extract set name from. Must not be null.
      Returns:
      amount of records matching the given query and entity class.
    • count

      long count(Query query, String setName)
      Return the amount of records in query results within the given set.
      Parameters:
      query - The query that provides the result set for count.
      setName - Set name to use.
      Returns:
      amount of documents matching the given query and set.
    • aggregate

      <T> com.aerospike.client.query.ResultSet aggregate(com.aerospike.client.query.Filter filter, Class<T> entityClass, String module, String function, List<com.aerospike.client.Value> arguments)
      Execute query, apply statement's aggregation function, and return result iterator.
      Parameters:
      filter - The filter to pass to the query.
      entityClass - The class to extract set name from. Must not be null.
      module - server package where user defined function resides.
      function - aggregation function name.
      arguments - arguments to pass to function name, if any.
      Returns:
      Result iterator.
    • aggregate

      com.aerospike.client.query.ResultSet aggregate(com.aerospike.client.query.Filter filter, String setName, String module, String function, List<com.aerospike.client.Value> arguments)
      Execute query within the given set, apply statement's aggregation function, and return result iterator.
      Parameters:
      filter - The filter to pass to the query.
      setName - Set name to use.
      module - server package where user defined function resides.
      function - aggregation function name.
      arguments - arguments to pass to function name, if any.
      Returns:
      Result iterator.
    • createIndex

      <T> void createIndex(Class<T> entityClass, String indexName, String binName, com.aerospike.client.query.IndexType indexType)
      Create an index with the specified name in Aerospike.
      Parameters:
      entityClass - The class to extract set name from. Must not be null.
      indexName - The index name. Must not be null.
      binName - The bin name to create the index on. Must not be null.
      indexType - The type of the index. Must not be null.
    • createIndex

      <T> void createIndex(Class<T> entityClass, String indexName, String binName, com.aerospike.client.query.IndexType indexType, com.aerospike.client.query.IndexCollectionType indexCollectionType)
      Create an index with the specified name in Aerospike.
      Parameters:
      entityClass - The class to extract set name from. Must not be null.
      indexName - The index name. Must not be null.
      binName - The bin name to create the index on. Must not be null.
      indexType - The type of the index. Must not be null.
      indexCollectionType - The collection type of the index. Must not be null.
    • createIndex

      <T> void createIndex(Class<T> entityClass, String indexName, String binName, com.aerospike.client.query.IndexType indexType, com.aerospike.client.query.IndexCollectionType indexCollectionType, com.aerospike.client.cdt.CTX... ctx)
      Create an index with the specified name in Aerospike.
      Parameters:
      entityClass - The class to extract set name from. Must not be null.
      indexName - The index name. Must not be null.
      binName - The bin name to create the index on. Must not be null.
      indexType - The type of the index. Must not be null.
      indexCollectionType - The collection type of the index. Must not be null.
      ctx - optional context to index on elements within a CDT.
    • createIndex

      void createIndex(String setName, String indexName, String binName, com.aerospike.client.query.IndexType indexType)
      Create an index with the specified name in Aerospike.
      Parameters:
      setName - Set name to use.
      indexName - The index name. Must not be null.
      binName - The bin name to create the index on. Must not be null.
      indexType - The type of the index. Must not be null.
    • createIndex

      void createIndex(String setName, String indexName, String binName, com.aerospike.client.query.IndexType indexType, com.aerospike.client.query.IndexCollectionType indexCollectionType)
      Create an index with the specified name in Aerospike.
      Parameters:
      setName - Set name to use.
      indexName - The index name. Must not be null.
      binName - The bin name to create the index on. Must not be null.
      indexType - The type of the index. Must not be null.
      indexCollectionType - The collection type of the index. Must not be null.
    • createIndex

      void createIndex(String setName, String indexName, String binName, com.aerospike.client.query.IndexType indexType, com.aerospike.client.query.IndexCollectionType indexCollectionType, com.aerospike.client.cdt.CTX... ctx)
      Create an index with the specified name in Aerospike.
      Parameters:
      setName - Set name to use.
      indexName - The index name. Must not be null.
      binName - The bin name to create the index on. Must not be null.
      indexType - The type of the index. Must not be null.
      indexCollectionType - The collection type of the index. Must not be null.
      ctx - optional context to index on elements within a CDT.
    • deleteIndex

      <T> void deleteIndex(Class<T> entityClass, String indexName)
      Delete an index with the specified name in Aerospike.
      Parameters:
      entityClass - The class to extract set name from. Must not be null.
      indexName - The index name. Must not be null.
    • deleteIndex

      void deleteIndex(String setName, String indexName)
      Delete an index with the specified name within the given set in Aerospike.
      Parameters:
      setName - Set name to use.
      indexName - The index name. Must not be null.
    • indexExists

      boolean indexExists(String indexName)
      Check whether an index with the specified name exists in Aerospike.
      Parameters:
      indexName - The Aerospike index name. Must not be null.
      Returns:
      true if exists