class GraphQL::Language::Cache

This cache is used by GraphQL::Language::Parser.parse_file when it’s enabled.

With Rails, parser caching may enabled by setting config.graphql.parser_cache = true in your Rails application.

The cache may be manually built by assigning GraphQL::Language::Parser.cache = GraphQL::Language::Cache.new(Pathname.new("some_dir"), secret: ENV.fetch("GRAPHQL_CACHE_SECRET")). The secret should be a stable value stored outside of the cache directory. When it isn’t provided, a process-local secret is generated and cache entries are rebuilt after the process restarts. Pass secret: nil to disable cache signing. This should only be used when the cache directory is trusted. This will create a directory (tmp/cache/graphql by default) that stores a cache of parsed files.

Much like bootsnap, the parser cache needs to be cleaned up manually. You will need to clear the cache directory for each new deployment of your application. Also note that the parser cache will grow as your schema is loaded, so the cache directory must be writable.

See GraphQL::Railtie for simple Rails integration