Interface GraphQLCacheProvider
-
@ProviderType public interface GraphQLCacheProvider
AGraphQLCacheProvider
is responsible for caching GraphQL queries, in order to provide support for persisted queries for theGraphQLServlet
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @Nullable String
cacheQuery(@NotNull String query, @NotNull String resourceType, @Nullable String selectorString)
Stores thequery
into the cache, potentially overriding a previous value.@Nullable String
getQuery(@NotNull String hash, @NotNull String resourceType, @Nullable String selectorString)
Attempts to retrieve a previously persisted query from the cache.
-
-
-
Method Detail
-
getQuery
@Nullable @Nullable String getQuery(@NotNull @NotNull String hash, @NotNull @NotNull String resourceType, @Nullable @Nullable String selectorString)
Attempts to retrieve a previously persisted query from the cache.- Parameters:
hash
- the query's SHA-256 hashresourceType
- the resource type of theGraphQLServlet
which will execute the query, since multiple servlets can be registeredselectorString
- the selector string with which theGraphQLServlet
is registered- Returns:
- the query, if found,
null
otherwise - See Also:
cacheQuery(String, String, String)
-
cacheQuery
@Nullable @Nullable String cacheQuery(@NotNull @NotNull String query, @NotNull @NotNull String resourceType, @Nullable @Nullable String selectorString)
Stores thequery
into the cache, potentially overriding a previous value. The method will return the query's SHA-256 hash if the persisting operation was successful. If not, anull
value must be returned.- Parameters:
query
- the GraphQL queryresourceType
- the resource type of theGraphQLServlet
which will execute the query, since multiple servlets can be registeredselectorString
- the selector string with which theGraphQLServlet
is registered- Returns:
- the query's SHA-256 hash, if the query was successfully cached;
null
if the query could not be cached
-
-