Skip to content

Add user-specific hash to cacheKey #3586

Closed
@firatoezcan

Description

@firatoezcan

Is your feature request related to a problem? Please describe.
Right now it's impossible to cache authenticated data which for some web-apps is most of it, especially considering some fields cannot even be queried for some backend permissions.
Obviously an easy solution would be to only cache fields that are the same for every user (anon/non-anon) but this get's pretty rough to maintain and is a non-solution when the whole app is user-specific. Instead it would be nice to add some user-specific data to the cacheKey and (somehow) group them together with the cacheKey that currently exists.

This obviously makes the cache bigger, but that's just something that happens with any caching strategy involving user data

Describe the solution you'd like

I'd like it if the cacheKey had some mechanic that allowed it to store different versions of the same "base"-cacheKey depending on given data. For now I see most of the benefits by including the header only, but this could be some special function that gets declared in the .meshrc.yaml in the future

Describe alternatives you've considered

Additional context

Implementing this makes the cache plugins more difficult since they would need to be able to invalidate f.e. the product.price field for every user. I know this can be done with HSET and HDEL but it would be more work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions