Interface QueryableMutableStore.MutableQuery<T,S extends QueryableMutableStore.MutableQuery<T,S>>

Type Parameters:
T - "Type" – type of the objects to query
S - "Self" – specification of the QueryableMutableStore.MutableQuery.
All Superinterfaces:
QueryableStore.Query<T,T,S>
Enclosing interface:
QueryableMutableStore<T>

public static interface QueryableMutableStore.MutableQuery<T,S extends QueryableMutableStore.MutableQuery<T,S>> extends QueryableStore.Query<T,T,S>
  • Method Details

    • retain

      void retain(long keptElements)
      Deletes all entries except the keptElements highest ones in terms of the provided order and query.

      For example, calling retain(4) after a query store.query(CREATION_TIME.after(Instant.now().minus(5, DAYS)).orderBy(Order.DESC) will remove every entry except those that
      • Match any conditions given by preceding queries (here: store.query(...) saying that only elements newer than five days may be kept), and
      • Are among the 4 first ones in terms of the order given by the query result (here: a descending order with the newest being first).
      This function is expected to only work in the realm of the QueryableMutableStore. For example, elements with other parent ids in some implementations are supposed to remain unaffected.

      Note: deleteAll() is identical to retain(0).
      Parameters:
      keptElements - Quantity of entities to be retained.
      Since:
      3.9.0
    • deleteAll

      void deleteAll()
      Deletes all entries matching the given query conditions.

      For example, calling deleteAll() after a query store.query(CREATION_TIME.before(Instant.now().minus(5, DAYS)) will remove every entry with a CREATION_TIME property older than five days and keep those that don't match this condition (newer date).
      If no conditions have been selected beforehand, all entries in the realm of this QueryableMutableStore instance will be removed. It does not affect the structure of the store, and new entries may be added afterwards.

      This function is expected to only work in the realm of the QueryableMutableStore. For example, elements with other parent ids are supposed to remain unaffected.

      Note: Consider retain(long) if you prefer to deliberately keep a given amounts of elements instead.
      Since:
      3.9.0