Class SimpleGraphQLCacheProvider
- java.lang.Object
-
- org.apache.sling.graphql.core.cache.SimpleGraphQLCacheProvider
-
- All Implemented Interfaces:
GraphQLCacheProvider
public class SimpleGraphQLCacheProvider extends Object implements GraphQLCacheProvider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceSimpleGraphQLCacheProvider.Config
-
Constructor Summary
Constructors Constructor Description SimpleGraphQLCacheProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable StringcacheQuery(@NotNull String query, @NotNull String resourceType, @Nullable String selectorString)Stores thequeryinto the cache, potentially overriding a previous value.@Nullable StringgetQuery(@NotNull String hash, @NotNull String resourceType, @Nullable String selectorString)Attempts to retrieve a previously persisted query from the cache.
-
-
-
Method Detail
-
getQuery
@Nullable public @Nullable String getQuery(@NotNull @NotNull String hash, @NotNull @NotNull String resourceType, @Nullable @Nullable String selectorString)
Description copied from interface:GraphQLCacheProviderAttempts to retrieve a previously persisted query from the cache.- Specified by:
getQueryin interfaceGraphQLCacheProvider- Parameters:
hash- the query's SHA-256 hashresourceType- the resource type of theGraphQLServletwhich will execute the query, since multiple servlets can be registeredselectorString- the selector string with which theGraphQLServletis registered- Returns:
- the query, if found,
nullotherwise - See Also:
GraphQLCacheProvider.cacheQuery(String, String, String)
-
cacheQuery
@Nullable public @Nullable String cacheQuery(@NotNull @NotNull String query, @NotNull @NotNull String resourceType, @Nullable @Nullable String selectorString)
Description copied from interface:GraphQLCacheProviderStores thequeryinto 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, anullvalue must be returned.- Specified by:
cacheQueryin interfaceGraphQLCacheProvider- Parameters:
query- the GraphQL queryresourceType- the resource type of theGraphQLServletwhich will execute the query, since multiple servlets can be registeredselectorString- the selector string with which theGraphQLServletis registered- Returns:
- the query's SHA-256 hash, if the query was successfully cached;
nullif the query could not be cached
-
-