org.apache.ignite.cache

## Enum CacheMode

- java.lang.Object
- - java.lang.Enum<CacheMode>
  - - org.apache.ignite.cache.CacheMode

- All Implemented Interfaces:
    Serializable, Comparable<CacheMode>

      public enum CacheMode
      extends Enum<CacheMode>

  Enumeration of all supported caching modes. Cache mode is specified in `CacheConfiguration` and cannot be changed after cache has started.

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `PARTITIONED` Specifies partitioned cache behaviour.
    `REPLICATED` Specifies fully replicated cache behavior.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte` | `code()`
    `static @Nullable CacheMode` | `fromCode(int code)` Efficiently gets enumerated value from its code.
    `static byte` | `toCode(@Nullable CacheMode mode)`
    `static CacheMode` | `valueOf(String name)` Returns the enum constant of this type with the specified name.
    `static CacheMode[]` | `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

    - #### REPLICATED

          public static final CacheMode REPLICATED

      Specifies fully replicated cache behavior. In this mode all the keys are distributed to all participating nodes. User still has affinity control over subset of nodes for any given key via `AffinityFunction` configuration.

    - #### PARTITIONED

          public static final CacheMode PARTITIONED

      Specifies partitioned cache behaviour. In this mode the overall key set will be divided into partitions and all partitions will be split equally between participating nodes. User has affinity control over key assignment via `AffinityFunction` configuration.

      Note that partitioned cache is always fronted by local `'near'` cache which stores most recent data. You can configure the size of near cache via `NearCacheConfiguration.getNearEvictionPolicyFactory()` configuration property.

  - ### Method Detail

    - #### values

          public static CacheMode[] 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 (CacheMode c : CacheMode.values())
              System.out.println(c);

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

    - #### valueOf

          public static CacheMode 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

    - #### code

          public byte code()

      Returns:
        Cache mode code.

    - #### fromCode

          @Nullable
          public static @Nullable CacheMode fromCode(int code)

      Efficiently gets enumerated value from its code.
      Parameters:
        `code` - Code.
      Returns:
        Enumerated value or `null` if an out of range.

    - #### toCode

          public static byte toCode(@Nullable
                                    @Nullable CacheMode mode)

      Parameters:
        `mode` - Cache mode.
      Returns:
        Cache mode code.

${current.year} Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.16.0
Release Date | : December 15 2023