org.apache.cayenne.query

## Class CacheableQuery

- java.lang.Object
- - org.apache.cayenne.query.CacheableQuery

- All Implemented Interfaces:
    Serializable, Query
  Direct Known Subclasses:
    AbstractQuery, EJBQLQuery

      public abstract class CacheableQuery
      extends Object
      implements Query

  Shared functionality for cacheable queries.
  Since:
    4.0
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static org.slf4j.Logger` | `logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CacheableQuery()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract org.apache.cayenne.query.BaseQueryMetadata` | `getBaseMetaData()`
    `String` | `getCacheGroup()`
    `String[]` | `getCacheGroups()` Deprecated. since 4.0, use `getCacheGroup()`
    `QueryCacheStrategy` | `getCacheStrategy()`
    `void` | `setCacheGroup(String cacheGroup)`
    `void` | `setCacheGroups(String... cacheGroups)` Deprecated. since 4.0, use `setCacheGroup(String)`
    `void` | `setCacheStrategy(QueryCacheStrategy strategy)`
    `void` | `useLocalCache()` Instructs Cayenne to look for query results in the "local" cache when running the query.
    `void` | `useLocalCache(String... cacheGroups)` Deprecated. since 4.0, use `useLocalCache(String)`
    `void` | `useLocalCache(String cacheGroup)` Instructs Cayenne to look for query results in the "local" cache when running the query.
    `void` | `useSharedCache()` Instructs Cayenne to look for query results in the "shared" cache when running the query.
    `void` | `useSharedCache(String... cacheGroups)` Deprecated. since 4.0, use `useSharedCache(String)`
    `void` | `useSharedCache(String cacheGroup)` Instructs Cayenne to look for query results in the "shared" cache when running the query.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.cayenne.query.Query

      `createSQLAction, getDataMap, getMetaData, getName, route`

- - ### Field Detail

    - #### logger

          protected static final org.slf4j.Logger logger

  - ### Constructor Detail

    - #### CacheableQuery

          public CacheableQuery()

  - ### Method Detail

    - #### getBaseMetaData

          protected abstract org.apache.cayenne.query.BaseQueryMetadata getBaseMetaData()

    - #### getCacheStrategy

          public QueryCacheStrategy getCacheStrategy()

      Since:
        3.0

    - #### setCacheStrategy

          public void setCacheStrategy(QueryCacheStrategy strategy)

      Since:
        3.0

    - #### getCacheGroups

          @Deprecated
          public String[] getCacheGroups()

      Deprecated. since 4.0, use `getCacheGroup()`
      Since:
        3.0

    - #### getCacheGroup

          public String getCacheGroup()

      Since:
        4.0

    - #### setCacheGroups

          @Deprecated
          public void setCacheGroups(String... cacheGroups)

      Deprecated. since 4.0, use `setCacheGroup(String)`
      Since:
        3.0

    - #### setCacheGroup

          public void setCacheGroup(String cacheGroup)

      Since:
        4.0

    - #### useLocalCache

          public void useLocalCache()

      Instructs Cayenne to look for query results in the "local" cache when running the query. This is a short-hand notation for:

           query.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE);

      Since:
        4.0

    - #### useLocalCache

          public void useLocalCache(String cacheGroup)

      Instructs Cayenne to look for query results in the "local" cache when running the query. This is a short-hand notation for:

           query.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE);
           query.setCacheGroups("group1", "group2");

      Since:
        4.0

    - #### useLocalCache

          @Deprecated
          public void useLocalCache(String... cacheGroups)

      Deprecated. since 4.0, use `useLocalCache(String)`
      Instructs Cayenne to look for query results in the "local" cache when running the query. This is a short-hand notation for:

           query.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE);
           query.setCacheGroups("group1", "group2");

      Since:
        4.0

    - #### useSharedCache

          @Deprecated
          public void useSharedCache(String... cacheGroups)

      Deprecated. since 4.0, use `useSharedCache(String)`
      Instructs Cayenne to look for query results in the "shared" cache when running the query. This is a short-hand notation for:

           query.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE);
           query.setCacheGroups("group1", "group2");

      Since:
        4.0

    - #### useSharedCache

          public void useSharedCache()

      Instructs Cayenne to look for query results in the "shared" cache when running the query. This is a short-hand notation for:

           query.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE);

      Since:
        4.0

    - #### useSharedCache

          public void useSharedCache(String cacheGroup)

      Instructs Cayenne to look for query results in the "shared" cache when running the query. This is a short-hand notation for:

           query.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE);
           query.setCacheGroups("group1", "group2");

      Since:
        4.0

Copyright © 2001–2018 Apache Cayenne. All rights reserved.