org.keycloak.models.cache.infinispan

## Class DefaultLazyLoader<S,D>

- java.lang.Object
- - org.keycloak.models.cache.infinispan.DefaultLazyLoader<S,D>

- All Implemented Interfaces:
    LazyLoader<S,D>

      public class DefaultLazyLoader<S,D>
      extends Object
      implements LazyLoader<S,D>

  Default implementation of `DefaultLazyLoader` that only fetches data once. This implementation is not thread-safe and cached data is assumed to not be shared across different threads to sync state.
  Author:
    Pedro Igor

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultLazyLoader(Function<S,D> loader, Supplier<D> fallback)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `D` | `get(Supplier<S> sourceSupplier)` Returns data from the given `source`.

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

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

- - ### Constructor Detail

    - #### DefaultLazyLoader

          public DefaultLazyLoader(Function<S,D> loader,
                                   Supplier<D> fallback)

  - ### Method Detail

    - #### get

          public D get(Supplier<S> sourceSupplier)

      Description copied from interface: `LazyLoader`
      Returns data from the given `source`. Data is only fetched from `source` once and only if necessary, it is up to implementations to decide the momentum to actually fetch data from source.
      Specified by:
        `get` in interface `LazyLoader<S,D>`
      Parameters:
        `sourceSupplier` - the source from where data will be fetched.
      Returns:
        the data from source

Copyright © 2020 JBoss by Red Hat. All rights reserved.