Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Allow more control of cache keys when using $resource #270

Open
jsternadel opened this issue Feb 8, 2018 · 0 comments
Open

Allow more control of cache keys when using $resource #270

jsternadel opened this issue Feb 8, 2018 · 0 comments

Comments

@jsternadel
Copy link

In my application I use $resource exclusively and have cache factories configured for each distinct resource. The issue I am running into is code very far removed from the resource needs to request a brand new object. I wrapped the resource in my own object and made the cache factory available. So calling something like Resource.clearCache() will remove all cache items for that resource. This works well but of course nukes the entire cache for that resource object.

I'm not entirely sure this is possible but i would like to be able to configure a cache factory to use a specific property from the returned JSON as the cache key. For example with a Mongo DB the _id is always unique and would be great if i could tell the cache factory to use this property as the key. I could then call Resource.clearCache('my_id') and this method would attempt to clear just the cache record for that key.

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

No branches or pull requests

1 participant