Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package graphql.cachecontrol;
import graphql.ExecutionInput;
import graphql.ExecutionResult;
import graphql.ExecutionResultImpl;
import graphql.PublicApi;
import graphql.execution.ResultPath;
import graphql.schema.DataFetchingEnvironment;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import static graphql.Assert.assertNotEmpty;
import static graphql.Assert.assertNotNull;
import static graphql.collect.ImmutableKit.map;
/**
* This class implements the graphql Cache Control specification as outlined in https://github.com/apollographql/apollo-cache-control
*
* To best use this class you need to pass a CacheControl object to each {@link graphql.schema.DataFetcher} and have them decide on
* the caching hint values.
*
* The easiest way to do this is create a CacheControl object at query start and pass it in as a "context" object via {@link ExecutionInput#getGraphQLContext()} and then have
* each {@link graphql.schema.DataFetcher} that wants to make cache control hints use that.
*
* Then at the end of the query you would call {@link #addTo(graphql.ExecutionResult)} to record the cache control hints into the {@link graphql.ExecutionResult}
* extensions map as per the specification.
*/
@PublicApi
public class CacheControl {
public static final String CACHE_CONTROL_EXTENSION_KEY = "cacheControl";
/**
* If the scope is set to PRIVATE, this indicates anything under this path should only be cached per-user,
* unless the value is overridden on a sub path. PUBLIC is the default and means anything under this path
* can be stored in a shared cache.
*/
public enum Scope {
PUBLIC, PRIVATE
}
private class Hint {
private final List