Class SourceSelectionMemoryCache
java.lang.Object
org.eclipse.rdf4j.federated.cache.SourceSelectionMemoryCache
- All Implemented Interfaces:
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetAssurance
(SubQuery subQuery, Endpoint endpoint) Ask the cache if a given endpoint can provide results for aSubQuery
.void
Invalidate the underlying cachevoid
updateInformation
(SubQuery subQuery, Endpoint endpoint, boolean hasStatements)
-
Field Details
-
DEFAULT_CACHE_SPEC
- See Also:
-
-
Constructor Details
-
SourceSelectionMemoryCache
public SourceSelectionMemoryCache() -
SourceSelectionMemoryCache
- Parameters:
cacheSpec
- a Guava compatibleCacheBuilderSpec
, ifnull
theDEFAULT_CACHE_SPEC
is used
-
-
Method Details
-
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 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_STATEMENTS
in order to trigger a remote check.invalid input: '<'/p- Specified by:
getAssurance
in interfaceSourceSelectionCache
- Parameters:
subQuery
-endpoint
-- Returns:
- the
SourceSelectionCache.StatementSourceAssurance
-
updateInformation
Description copied from interface:SourceSelectionCache
Update the information for a givenSubQuery
andEndpoint
.Implementations must make sure that any operations are thread-safe
- Specified by:
updateInformation
in interfaceSourceSelectionCache
- Parameters:
subQuery
-endpoint
-hasStatements
-
-
invalidate
public void invalidate()Description copied from interface:SourceSelectionCache
Invalidate the underlying cache- Specified by:
invalidate
in interfaceSourceSelectionCache
-