graphql-ruby-fragment_cache
graphql-ruby-fragment_cache copied to clipboard
Namespace issue
I understand that you can setup namespace by either
-
GraphQL::FragmentCache.namespace = "my-prefix"
-
GraphQL::FragmentCache.configure { |config| config.namespace = "my-prefix" }
It isn't clear to me whether I can set namespace under config.default_options
, eg
GraphQL::FragmentCache.configure do |config|
config.default_options = {
namespace: "my-prefix"
}
end
However when I did the above, I got unexpected behaviour where the cache store tries to read the cache key without namespace but write with the namespace as part of the cache key.
Frankly I would expect namespace to be configured as part of the cache store options in which case each individual cache store would handle the namespace
That's not an expected behavior, I guess it's just a scenario no one used before. By design, default_options
are passed to "all cache_fragment calls and cache_fragment: configurations" (see #PR65), namespace is used when cache key is created, it feels like it has nothing to do with the default options.
Closing this for now, feel free to reopen 🙂