Package org.apache.ignite.configuration

## Class NearCacheConfiguration<K,​V>

- java.lang.Object
- - org.apache.ignite.configuration.NearCacheConfiguration<K,​V>

- All Implemented Interfaces:
    `Serializable`

      public class NearCacheConfiguration<K,​V>
      extends Object
      implements Serializable

  Client (near) cache configuration.

  Distributed cache can also be fronted by a Near cache, which is a smaller local cache that stores most recently or most frequently accessed data. Just like with a partitioned cache, the user can control the size of the near cache and its eviction policies.

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `NearCacheConfiguration()` | Empty constructor.
    `NearCacheConfiguration​(NearCacheConfiguration<K,​V> ccfg)` | Creates near cache configuration copying properties from passed in configuration.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `EvictionPolicy<K,​V>` | `getNearEvictionPolicy()` | Deprecated. Use `getNearEvictionPolicyFactory()` instead.
    `@Nullable javax.cache.configuration.Factory<EvictionPolicy<? super K,​? super V>>` | `getNearEvictionPolicyFactory()` | Gets cache eviction policy factory.
    `int` | `getNearStartSize()` | Gets initial cache size for near cache which will be used to pre-create internal hash table after start.
    `NearCacheConfiguration<K,​V>` | `setNearEvictionPolicy​(EvictionPolicy<K,​V> nearEvictPlc)` | Deprecated. Use `setNearEvictionPolicyFactory(Factory)` instead.
    `NearCacheConfiguration<K,​V>` | `setNearEvictionPolicyFactory​(@Nullable javax.cache.configuration.Factory<? extends EvictionPolicy<? super K,​? super V>> nearEvictPlcFactory)` | Sets cache eviction policy factory.
    `NearCacheConfiguration<K,​V>` | `setNearStartSize​(int nearStartSize)` | Start size for near cache.
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### NearCacheConfiguration

          public NearCacheConfiguration()

      Empty constructor.

    - #### NearCacheConfiguration

          public NearCacheConfiguration​(NearCacheConfiguration<K,​V> ccfg)

      Creates near cache configuration copying properties from passed in configuration.
      Parameters:
        `ccfg` - Configuration to copy.

  - ### Method Detail

    - #### getNearEvictionPolicy

          @Deprecated
          public EvictionPolicy<K,​V> getNearEvictionPolicy()

      Deprecated.
      Use `getNearEvictionPolicyFactory()` instead.
      Gets near eviction policy. By default, returns `null` which means that evictions are disabled for near cache.
      Returns:
        Near eviction policy.
      See Also:
        `CacheConfiguration.getEvictionPolicy()`

    - #### setNearEvictionPolicy

          @Deprecated
          public NearCacheConfiguration<K,​V> setNearEvictionPolicy​(EvictionPolicy<K,​V> nearEvictPlc)

      Deprecated.
      Use `setNearEvictionPolicyFactory(Factory)` instead.
      Sets near eviction policy.
      Parameters:
        `nearEvictPlc` - Near eviction policy.
      Returns:
        `this` for chaining.

    - #### getNearEvictionPolicyFactory

          @Nullable
          public @Nullable javax.cache.configuration.Factory<EvictionPolicy<? super K,​? super V>> getNearEvictionPolicyFactory()

      Gets cache eviction policy factory. By default, returns `null` which means that evictions are disabled for cache.
      Returns:
        Cache eviction policy or `null` if evictions should be disabled.

    - #### setNearEvictionPolicyFactory

          public NearCacheConfiguration<K,​V> setNearEvictionPolicyFactory​(@Nullable
                                                                                @Nullable javax.cache.configuration.Factory<? extends EvictionPolicy<? super K,​? super V>> nearEvictPlcFactory)

      Sets cache eviction policy factory. Note: Eviction policy factory should be `Serializable`.
      Parameters:
        `nearEvictPlcFactory` - Cache expiration policy.
      Returns:
        `this` for chaining.

    - #### getNearStartSize

          public int getNearStartSize()

      Gets initial cache size for near cache which will be used to pre-create internal hash table after start. Default value is defined by `CacheConfiguration.DFLT_NEAR_START_SIZE`.
      Returns:
        Initial near cache size.

    - #### setNearStartSize

          public NearCacheConfiguration<K,​V> setNearStartSize​(int nearStartSize)

      Start size for near cache. This property is only used for `CacheMode.PARTITIONED` caching mode.
      Parameters:
        `nearStartSize` - Start size for near cache.
      Returns:
        `this` for chaining.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`