Class SourceSelectionMemoryCache
- java.lang.Object
-
- org.eclipse.rdf4j.federated.cache.SourceSelectionMemoryCache
-
- All Implemented Interfaces:
SourceSelectionCache
public class SourceSelectionMemoryCache extends Object implements SourceSelectionCache
An implementation ofSourceSelectionCachewhich uses an in memory GuavaCacheas 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 Description static StringDEFAULT_CACHE_SPEC
-
Constructor Summary
Constructors Constructor Description SourceSelectionMemoryCache()SourceSelectionMemoryCache(String cacheSpec)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SourceSelectionCache.StatementSourceAssurancegetAssurance(SubQuery subQuery, Endpoint endpoint)Ask the cache if a given endpoint can provide results for aSubQuery.voidinvalidate()Invalidate the underlying cachevoidupdateInformation(SubQuery subQuery, Endpoint endpoint, boolean hasStatements)
-
-
-
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 compatibleCacheBuilderSpec, ifnulltheDEFAULT_CACHE_SPECis used
-
-
Method Detail
-
getAssurance
public SourceSelectionCache.StatementSourceAssurance getAssurance(SubQuery subQuery, Endpoint endpoint)
Description copied from interface:SourceSelectionCacheAsk the cache if a given endpoint can provide results for aSubQuery.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_STATEMENTSin order to trigger a remote check.- Specified by:
getAssurancein interfaceSourceSelectionCache- Returns:
- the
SourceSelectionCache.StatementSourceAssurance
-
updateInformation
public void updateInformation(SubQuery subQuery, Endpoint endpoint, boolean hasStatements)
Description copied from interface:SourceSelectionCacheUpdate the information for a givenSubQueryandEndpoint.Implementations must make sure that any operations are thread-safe
- Specified by:
updateInformationin interfaceSourceSelectionCache
-
invalidate
public void invalidate()
Description copied from interface:SourceSelectionCacheInvalidate the underlying cache- Specified by:
invalidatein interfaceSourceSelectionCache
-
-