Interface PersistedQueryCache
- All Known Implementing Classes:
InMemoryPersistedQueryCache
-
Method Summary
Modifier and TypeMethodDescriptiongetPersistedQueryDocument
(Object persistedQueryId, ExecutionInput executionInput, PersistedQueryCacheMiss onCacheMiss) Deprecated.default CompletableFuture
<PreparsedDocumentEntry> getPersistedQueryDocumentAsync
(Object persistedQueryId, ExecutionInput executionInput, PersistedQueryCacheMiss onCacheMiss) This is called to get a persisted query from cache.
-
Method Details
-
getPersistedQueryDocument
@Deprecated PreparsedDocumentEntry getPersistedQueryDocument(Object persistedQueryId, ExecutionInput executionInput, PersistedQueryCacheMiss onCacheMiss) throws PersistedQueryNotFound Deprecated.This is called to get a persisted query from cache.If its present in cache then it must return a PreparsedDocumentEntry where
PreparsedDocumentEntry.getDocument()
is already parsed and validated. This will be passed onto the graphql engine as is.If it's a valid query id but its no present in cache, (cache miss) then you need to call back the "onCacheMiss" function with associated query text. This will be compiled and validated by the graphql engine and the PreparsedDocumentEntry will be passed back ready for you to cache it.
If it's not a valid query id then throw a
PersistedQueryNotFound
to indicate this.- Parameters:
persistedQueryId
- the persisted query idexecutionInput
- the original execution inputonCacheMiss
- the call back should it be a valid query id but it's not currently in the cache- Returns:
- a parsed and validated PreparsedDocumentEntry where
PreparsedDocumentEntry.getDocument()
is set - Throws:
PersistedQueryNotFound
- if the query id is not know at all and you have no query text
-
getPersistedQueryDocumentAsync
default CompletableFuture<PreparsedDocumentEntry> getPersistedQueryDocumentAsync(Object persistedQueryId, ExecutionInput executionInput, PersistedQueryCacheMiss onCacheMiss) throws PersistedQueryNotFound This is called to get a persisted query from cache.If its present in cache then it must return a PreparsedDocumentEntry where
PreparsedDocumentEntry.getDocument()
is already parsed and validated. This will be passed onto the graphql engine as is.If it's a valid query id but its no present in cache, (cache miss) then you need to call back the "onCacheMiss" function with associated query text. This will be compiled and validated by the graphql engine and the PreparsedDocumentEntry will be passed back ready for you to cache it.
If it's not a valid query id then throw a
PersistedQueryNotFound
to indicate this.- Parameters:
persistedQueryId
- the persisted query idexecutionInput
- the original execution inputonCacheMiss
- the call back should it be a valid query id but it's not currently in the cache- Returns:
- a promise to parsed and validated
PreparsedDocumentEntry
wherePreparsedDocumentEntry.getDocument()
is set - Throws:
PersistedQueryNotFound
- if the query id is not know at all and you have no query text
-
getPersistedQueryDocumentAsync(Object persistedQueryId, ExecutionInput executionInput, PersistedQueryCacheMiss onCacheMiss)