Skip to content

Conversation

factyy
Copy link
Contributor

@factyy factyy commented Jul 29, 2025

The original cache implementation relies on two main parts: scope and query.

Quite often we use scoping as a policy-based access control for listing actions like index. With Graphiti it is easily achieved by making #base_scope context-aware (e.g. like checking a requesting user role and restricting access to certain entities for non-admins). The problem is that it is only represented via changes in the DB query object (we have different cache keys for different scopes since they result in different queries). One of the side effects is that Graphiti has no idea about it and cache debugger stubbornly states lots and lots of cache misses (it associates cache keys with the request info that doesn't include any info from the request context).

The idea behind this PR is simple: enable cache tagging with a value returned from a resource instance method (that can access request context). This method name has to be passed as a symbol argument to the cache_resource resource class method alongside expires_in argument.

@superslau
Copy link
Contributor

I have a very similar issue, so interested to see what is necessary for this to get merged.

@factyy
Copy link
Contributor Author

factyy commented Oct 1, 2025

@jkeen , sorry to bother, is there anything I can help you with to merge this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants