Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

ng-resource Conditional/bypass Cache #9064

@k-funk

Description

@k-funk

This is a feature request.

I'd really like if I could bypass the cache, conditionally, from a $resource class. I've put cache: true for each of my resource actions that I want to reload from memory/cache, but I'd like to bypass the cache during certain calls. Most of my application resides in angular, but occasionally a user will take an action that requires refreshing an endpoint.

I don't need a complex cache, just an occasional hit to the server for fresh data, as decided in a controller.

IE:

var User = $resource(
  '/user/:userId',
  {userId:'@id'},
  {get: {method: 'GET', cache: true}}
);
User.get({userId:123});
User.get({userId:123, cache: true}); // same as above
User.get({userId:123, cache: false}); // don't use the cache, this one time.

This stackoverflow question was asked, which a fix this feature would be a better solution for.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions