简体   繁体   English

Angular:$ resource cache选项不缓存

[英]Angular : $resource cache option does not cache

I have a quite basic $resource call : 我有一个非常基本的$资源调用:

getActiveListUsers = function(departmentId){
    var activeUsersList = $resource("rest/users/active", {}, {
        'getActiveUsersList': {method: 'GET', isArray: true, cache : true}
    });

    return activeUsersList.getActiveUsersList(
                    {departmentId: departmentId}
    );
}

Though, when I look through network calls, I see that the same request is always called, and when I look at the 'cache' part of the request, I see it is fetched every time. 但是,当我查看网络调用时,我看到始终调用相同的请求,当我查看请求的“缓存”部分时,我看到它每次都被提取。

I am surely doing it the wrong way (or understanding it the wrong way!)... thus, any tip is welcomed here! 我肯定是以错误的方式做到这一点(或以错误的方式理解它!)...因此,欢迎任何提示!

Thanks in advance! 提前致谢!

Angular version : 1.2.16 (cannot be upgraded) 角度版本:1.2.16(无法升级)

Look at this article it might help you to use $resource cache in a much better manner... 看看这篇文章它可能会帮助你以更好的方式使用$ resource cache ...

http://blog.aliasapps.com/caching-get-requests-using-angular-resource/ http://blog.aliasapps.com/caching-get-requests-using-angular-resource/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM