ChilliCream / ChilliCream/graphql-platform

Allow for "namespacing" of persisted queries within Redis

Open
#8,414 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🌶️ hot chocolate Area: Persisted Queries
Dominant language
C#
Stars
5.8k
Forks
810
Avg merge
15h 39m
Merged PRs (30d)
98

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the AddRedisOperationDocumentStorage configuration entry point and trace how persisted query keys are created in Redis. The change is complete when an optional namespace prefixes those keys while the default preserves existing behavior; check the surrounding storage tests if available.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, graphql, redis
Domain
api, backend, database
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.