Skip to content

Allow for "namespacing" of persisted queries within Redis #8414

@kchenery

Description

@kchenery

Product

Hot Chocolate

Is your feature request related to a problem?

Not really a problem per se.... (more a feature request)

When using Redis for caching of various "things" (not just GraphQL persisted queries) it would be useful to be able to namespace the GraphQL persisted queries to easily identify/separate them from other keys.

I know a hash is unlikely to have any kind of key conflict. That is not the primary driver of this at all. An example use case is wanting to purge all keys of a particular "type". Having a namespace makes this far easier to achieve. Another use case would be where you have multiple graphql services and want to identify one over another.

For example;
If we have a persisted query hash of adbe3372b917b7eb34a43f08f39a3d62
I would expect a namespaced key to be something like GraphQL:adbe3372b917b7eb34a43f08f39a3d62

I am aware an alternative solution to all of this is the use of databases within Redis. Some libraries have problems with anything other than the default database (probably not a concern with StackExchange.Redis).

The solution you'd like

When calling .AddRedisOperationDocumentStorage to configure Redis I would want to be able pass in a "namespace" value. The default could be null to maintain backwards compatibility and existing behaviour.

I'm going to put in a PR to achieve the above.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions