我正在阅读文档中的以下内容:
To enable caching, set the request configuration cache property to
true (to use default cache) or to a custom cache object
(built with $cacheFactory).
谁能告诉我。缓存数据存储在哪里?另外,使用 $cacheFactory 和 的优势是什么我如何使用 自定义缓存工厂和 HTTP ?
最佳答案
1) 数据存储在内存中(例如在您的浏览器中)
2)避免对同一资源(例如模板文件)进行多个服务器请求
3) 使用:var cache = $cacheFactory('yourCacheId');
您可以创建自己的缓存。这样做的好处是,您可以清除特定资源 ( cache.removeAll
) 的缓存。
独奏:http://docs.angularjs.org/api/ng.$cacheFactory
关于angularjs - AngularJS HTTP 在缓存对象时将它们存储在哪里?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21284747/