org.apache.cayenne.query

## Enum QueryCacheStrategy

- java.lang.Object
- - java.lang.Enum<QueryCacheStrategy>
  - - org.apache.cayenne.query.QueryCacheStrategy

- All Implemented Interfaces:
    Serializable, Comparable<QueryCacheStrategy>

      public enum QueryCacheStrategy
      extends Enum<QueryCacheStrategy>

  Defines query result caching policy.
  Since:
    3.0

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `LOCAL_CACHE` A cache policy stating that query results shall be cached by the ObjectContext that originated the query, independent from any other ObjectContexts.
    `LOCAL_CACHE_REFRESH` A cache policy stating that query results shall be cached by the ObjectContext that originated the query, independent from any other ObjectContexts, however the query that uses this policy should treat current cache state as expired, and force the database fetch.
    `NO_CACHE` A default cache policy stating that the query results should not be cached.
    `SHARED_CACHE` A cache policy ruling that query results shall be cached in a shared location accessible by all ObjectContexts.
    `SHARED_CACHE_REFRESH` A cache policy ruling that query results shall be cached in a shared location accessible by all ObjectContexts, however the query that uses this policy should treat current cache state as expired, and force the database fetch.

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static QueryCacheStrategy` | `getDefaultStrategy()` Returns the default strategy - `NO_CACHE`.
    `static QueryCacheStrategy` | `safeValueOf(String string)` Returns QueryCacheStrategy for the specified string name or default strategy for invalid names.
    `static QueryCacheStrategy` | `valueOf(String name)` Returns the enum constant of this type with the specified name.
    `static QueryCacheStrategy[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

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

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

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

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### NO_CACHE

          public static final QueryCacheStrategy NO_CACHE

      A default cache policy stating that the query results should not be cached.

    - #### LOCAL_CACHE

          public static final QueryCacheStrategy LOCAL_CACHE

      A cache policy stating that query results shall be cached by the ObjectContext that originated the query, independent from any other ObjectContexts.

    - #### LOCAL_CACHE_REFRESH

          public static final QueryCacheStrategy LOCAL_CACHE_REFRESH

      A cache policy stating that query results shall be cached by the ObjectContext that originated the query, independent from any other ObjectContexts, however the query that uses this policy should treat current cache state as expired, and force the database fetch.

    - #### SHARED_CACHE

          public static final QueryCacheStrategy SHARED_CACHE

      A cache policy ruling that query results shall be cached in a shared location accessible by all ObjectContexts.

    - #### SHARED_CACHE_REFRESH

          public static final QueryCacheStrategy SHARED_CACHE_REFRESH

      A cache policy ruling that query results shall be cached in a shared location accessible by all ObjectContexts, however the query that uses this policy should treat current cache state as expired, and force the database fetch.

  - ### Method Detail

    - #### values

          public static QueryCacheStrategy[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (QueryCacheStrategy c : QueryCacheStrategy.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static QueryCacheStrategy valueOf(String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
        `name` - the name of the enum constant to be returned.
      Returns:
        the enum constant with the specified name
      Throws:
        `IllegalArgumentException` - if this enum type has no constant with the specified name
        `NullPointerException` - if the argument is null

    - #### safeValueOf

          public static QueryCacheStrategy safeValueOf(String string)

      Returns QueryCacheStrategy for the specified string name or default strategy for invalid names.

    - #### getDefaultStrategy

          public static QueryCacheStrategy getDefaultStrategy()

      Returns the default strategy - `NO_CACHE`.

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