Interface QueryResultsCache

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      void close()
      Method to close the cache when no longer needed.
      boolean contains​(String queryKey)
      Accessor for whether the specified query is in the cache
      void evict​(Class candidate)
      Method to evict all queries that use the provided class as candidate.
      void evict​(Query query)
      Evict the query from the results cache.
      void evict​(Query query, Map params)
      Evict the query with the specified params from the results cache.
      void evictAll()
      Method to clear the cache.
      List<Object> get​(String queryKey)
      Accessor for the results from the cache.
      default boolean isEmpty()
      Accessor for whether the cache is empty.
      default void pin​(Query query)
      Method to pin the specified query in the cache, preventing garbage collection.
      default void pin​(Query query, Map params)
      Method to pin the specified query in the cache, preventing garbage collection.
      List<Object> put​(String queryKey, List<Object> results)
      Method to put an object in the cache.
      default int size()
      Accessor for the total number of results in the query cache.
      default void unpin​(Query query)
      Method to unpin the specified query from the cache, allowing garbage collection.
      default void unpin​(Query query, Map params)
      Method to unpin the specified query from the cache, allowing garbage collection.
    • Method Detail

      • close

        void close()
        Method to close the cache when no longer needed. Provides a hook to release resources etc.
      • evict

        void evict​(Class candidate)
        Method to evict all queries that use the provided class as candidate. This is usually called when an instance of the candidate has been changed in the datastore.
        Parameters:
        candidate - The candidate
      • evict

        void evict​(Query query)
        Evict the query from the results cache.
        Parameters:
        query - The query to evict (evicts all use of this query, with any params)
      • evict

        void evict​(Query query,
                   Map params)
        Evict the query with the specified params from the results cache.
        Parameters:
        query - The query to evict
        params - The parameters
      • evictAll

        void evictAll()
        Method to clear the cache.
      • pin

        default void pin​(Query query)
        Method to pin the specified query in the cache, preventing garbage collection.
        Parameters:
        query - The query
      • pin

        default void pin​(Query query,
                         Map params)
        Method to pin the specified query in the cache, preventing garbage collection.
        Parameters:
        query - The query
        params - Its params
      • unpin

        default void unpin​(Query query)
        Method to unpin the specified query from the cache, allowing garbage collection.
        Parameters:
        query - The query
      • unpin

        default void unpin​(Query query,
                           Map params)
        Method to unpin the specified query from the cache, allowing garbage collection.
        Parameters:
        query - The query
        params - Its params
      • isEmpty

        default boolean isEmpty()
        Accessor for whether the cache is empty.
        Returns:
        Whether it is empty.
      • size

        default int size()
        Accessor for the total number of results in the query cache.
        Returns:
        Number of queries
      • get

        List<Object> get​(String queryKey)
        Accessor for the results from the cache.
        Parameters:
        queryKey - The query key
        Returns:
        The cached query result ids
      • put

        List<Object> put​(String queryKey,
                         List<Object> results)
        Method to put an object in the cache.
        Parameters:
        queryKey - The query key
        results - The results for this query
        Returns:
        The result ids previously associated with this query (if any)
      • contains

        boolean contains​(String queryKey)
        Accessor for whether the specified query is in the cache
        Parameters:
        queryKey - The query key
        Returns:
        Whether it is in the cache