Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Entity caching invalidation does not respect namespace setting #6195

Open
lleadbet opened this issue Oct 25, 2024 · 0 comments
Open

Entity caching invalidation does not respect namespace setting #6195

lleadbet opened this issue Oct 25, 2024 · 0 comments

Comments

@lleadbet
Copy link
Contributor

Describe the bug

The entity caching feature currently works alongside the global namespace setting, however when attempting to invalidate, the SCAN used is not using that namespace for that operation. As a result, the cache is unable to be invalidated outside of the normal TTL supported.

To Reproduce

Use a config like:

preview_entity_cache: 
  enabled: true
  metrics:
    enabled: true
    separate_per_type: true
  invalidation:
    concurrent_requests: 10
    listen: 0.0.0.0:4000
    path: /invalidate
    scan_count: 1000

  subgraph:
    all: 
      enabled: true
      invalidation:
        enabled: true
        shared_key: test
      redis:
        urls:
          - redis://redis:6379
        timeout: 10ms
        required_to_start: true
        namespace: entity-cache
        ttl: 1h

And start up a Redis service locally alongside cacheable subgraphs. Make a few requests and note that you are seeing cached responses.

Attempt to clear the cache using the invalidation API or subgraph extensions and note that the cache won't be busted on repeating the original request.

Expected behavior

Invalidation works with the namespace setting.

Output

redis-cli's monitor command:

1729863387.652947 [0 172.18.0.6:33798] "SCAN" "0" "MATCH" "version:1.0:subgraph:users:*" "COUNT" "1000"

Where the above is using the same config noted in the reproduction steps. Note the missing entity-cache: prefix.

For reference, here's the GET command for that same config:

1729863301.184325 [0 172.18.0.6:33798] "GET" "entity-cache:version:1.0:subgraph:users:type:User:entity:5811967f540d300d249ab30ae681359a7815fdb5d3dc71a94be1d491006a6b27:hash:a29c32fcde60321f0344e223e3b26edbad8375eab0cd5aa68c3ad0e1e29d5906:data:d9d84a3c7ffc27b0190a671212f3740e5b8478e84e23825830e97822e25cf05c"

Desktop (please complete the following information):

  • OS: macOS
  • Version: 1.57.0
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant