TestCacheLoader (Apache Geode 1.8.0)
Date: 2018-11-29

org.apache.geode.cache30

## Class TestCacheLoader<K,V>

- java.lang.Object
- - org.apache.geode.cache30.TestCacheCallback
  - - org.apache.geode.cache30.TestCacheLoader<K,V>

- All Implemented Interfaces:
    CacheCallback, CacheLoader<K,V>, Declarable
  Direct Known Subclasses:
    ClientServerTestCase.CacheServerCacheLoader

      public abstract class TestCacheLoader<K,V>
      extends TestCacheCallback
      implements CacheLoader<K,V>

  A `CacheLoader` used in testing. Users should override the "2" method.
  Since:
    GemFire 3.0
  See Also:
    `TestCacheCallback.wasInvoked()`, `TestCacheWriter`

- - ### Field Summary

    - ### Fields inherited from class org.apache.geode.cache30.TestCacheCallback

      `callbackError`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TestCacheLoader()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `V` | `load(LoaderHelper<K,V> helper)` Loads a value.
    `abstract V` | `load2(LoaderHelper<K,V> helper)`

    - ### Methods inherited from class org.apache.geode.cache30.TestCacheCallback

      `close, close2, isClosed, waitForInvocation, waitForInvocation, wasInvoked`

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

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

    - ### Methods inherited from interface org.apache.geode.cache.CacheCallback

      `close`

    - ### Methods inherited from interface org.apache.geode.cache.Declarable

      `init, initialize`

- - ### Constructor Detail

    - #### TestCacheLoader

          public TestCacheLoader()

  - ### Method Detail

    - #### load

          public V load(LoaderHelper<K,V> helper)
                 throws CacheLoaderException

      Description copied from interface: `CacheLoader`
      Loads a value. Application writers should implement this method to customize the loading of a value. This method is called by the caching service when the requested value is not in the cache. Any exception (including an unchecked exception) thrown by this method is propagated back to and thrown by the invocation of `Region.get(Object, Object)` that triggered this load.

      Specified by:
        `load` in interface `CacheLoader<K,V>`
      Parameters:
        `helper` - a LoaderHelper object that is passed in from cache service and provides access to the key, region, argument, and `netSearch`.
      Returns:
        the value supplied for this key, or null if no value can be supplied. A local loader will always be invoked if one exists. Otherwise one remote loader is invoked. Returning `null` causes `Region.get(Object, Object)` to return `null`.
      Throws:
        `CacheLoaderException`
      See Also:
        `Region.get`

    - #### load2

          public abstract V load2(LoaderHelper<K,V> helper)
                           throws CacheLoaderException

      Throws:
        `CacheLoaderException`