org.eclipse.rdf4j.federated.cache

## Class SourceSelectionMemoryCache

- java.lang.Object
- - org.eclipse.rdf4j.federated.cache.SourceSelectionMemoryCache

- All Implemented Interfaces:
    SourceSelectionCache

      public class SourceSelectionMemoryCache
      extends Object
      implements SourceSelectionCache

  An implementation of `SourceSelectionCache` which uses an in memory Guava `Cache` as data structure to maintain information.
  Author:
    Andreas Schwarte

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.eclipse.rdf4j.federated.cache.SourceSelectionCache

      `SourceSelectionCache.StatementSourceAssurance`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DEFAULT_CACHE_SPEC`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SourceSelectionMemoryCache()`
    `SourceSelectionMemoryCache(String cacheSpec)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `SourceSelectionCache.StatementSourceAssurance` | `getAssurance(SubQuery subQuery, Endpoint endpoint)` Ask the cache if a given endpoint can provide results for a `SubQuery`.
    `void` | `updateInformation(SubQuery subQuery, Endpoint endpoint, boolean hasStatements)` Update the information for a given `SubQuery` and `Endpoint`.

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

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

- - ### Field Detail

    - #### DEFAULT_CACHE_SPEC

          public static final String DEFAULT_CACHE_SPEC

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SourceSelectionMemoryCache

          public SourceSelectionMemoryCache()

    - #### SourceSelectionMemoryCache

          public SourceSelectionMemoryCache(String cacheSpec)

      Parameters:
        `cacheSpec` - a Guava compatible `CacheBuilderSpec`, if `null` the `DEFAULT_CACHE_SPEC` is used

  - ### Method Detail

    - #### getAssurance

          public SourceSelectionCache.StatementSourceAssurance getAssurance(SubQuery subQuery,
                                                                            Endpoint endpoint)

      Description copied from interface: `SourceSelectionCache`
      Ask the cache if a given endpoint can provide results for a `SubQuery`.

      Implementations may infer information by applying logical rules, e.g. if a cache knows that an endpoint can provide statements {s, foaf:name, "Alan"}, it can also provide results for {s, foaf:name, ?name}.

      If a cache cannot provide information for the given arguments, it must return `SourceSelectionCache.StatementSourceAssurance.POSSIBLY_HAS_STATEMENTS` in order to trigger a remote check.

      Specified by:
        `getAssurance` in interface `SourceSelectionCache`
      Returns:
        the `SourceSelectionCache.StatementSourceAssurance`

    - #### updateInformation

          public void updateInformation(SubQuery subQuery,
                                        Endpoint endpoint,
                                        boolean hasStatements)

      Description copied from interface: `SourceSelectionCache`
      Update the information for a given `SubQuery` and `Endpoint`.

      Implementations must make sure that any operations are thread-safe

      Specified by:
        `updateInformation` in interface `SourceSelectionCache`

Copyright © 2015-2021 Eclipse Foundation. All Rights Reserved.