Q - the type of query that is being cachedpublic class SimpleQueryCache<Q extends ReasonerQueryImpl> extends QueryCacheBase<Q,QueryAnswers>
Container class for storing performed query resolutions. Cache operations are handled in the following way: - GET(Query) - retrieve an entry corresponding to a provided query, if entry doesn't exist return db lookup result of the query. - RECORD(Query) - if the query entry exists, update the entry, otherwise create a new entry. In each case return an up-to-date entry.
| Constructor and Description |
|---|
SimpleQueryCache() |
| Modifier and Type | Method and Description |
|---|---|
ConceptMap |
getAnswer(Q query,
ConceptMap ans)
find specific answer to a query in the cache
|
QueryAnswers |
getAnswers(Q query)
retrieve (possibly) cached answers for provided query
|
java.util.stream.Stream<ConceptMap> |
getAnswerStream(Q query) |
Pair<java.util.stream.Stream<ConceptMap>,MultiUnifier> |
getAnswerStreamWithUnifier(Q query) |
Pair<QueryAnswers,MultiUnifier> |
getAnswersWithUnifier(Q query) |
ConceptMap |
record(Q query,
ConceptMap answer)
record a specific answer to a given query
|
ConceptMap |
record(Q query,
ConceptMap answer,
MultiUnifier unifier)
record a specific answer to a given query with a known cache unifier
|
QueryAnswers |
record(Q query,
QueryAnswers answers)
record answer iterable for a specific query and retrieve the updated answers
|
java.util.stream.Stream<ConceptMap> |
record(Q query,
java.util.stream.Stream<ConceptMap> answerStream)
record answer stream for a specific query and retrieve the updated stream
|
clear, contains, getQueries, merge, ruleCachepublic QueryAnswers record(Q query, QueryAnswers answers)
QueryCachequery - to be recordedanswers - to this querypublic java.util.stream.Stream<ConceptMap> record(Q query, java.util.stream.Stream<ConceptMap> answerStream)
QueryCachequery - to be recordedanswerStream - answer stream of the querypublic ConceptMap record(Q query, ConceptMap answer)
query - to which an answer is to be recordedanswer - specific answer to the querypublic ConceptMap record(Q query, ConceptMap answer, @Nullable MultiUnifier unifier)
query - to which an answer is to be recordedanswer - answer specific answer to the queryunifier - between the cached and input querypublic QueryAnswers getAnswers(Q query)
QueryCachequery - for which to retrieve answerspublic java.util.stream.Stream<ConceptMap> getAnswerStream(Q query)
public Pair<QueryAnswers,MultiUnifier> getAnswersWithUnifier(Q query)
getAnswersWithUnifier in class QueryCacheBase<Q extends ReasonerQueryImpl,QueryAnswers>public Pair<java.util.stream.Stream<ConceptMap>,MultiUnifier> getAnswerStreamWithUnifier(Q query)
getAnswerStreamWithUnifier in class QueryCacheBase<Q extends ReasonerQueryImpl,QueryAnswers>public ConceptMap getAnswer(Q query, ConceptMap ans)
query - input queryans - sought specific answer to the queryCopyright © 2018 Grakn Labs Ltd. All rights reserved.