哪里的AngularJS HTTP存储对象,他们被缓存的时候? [英] Where does the AngularJS HTTP store objects when they are cached?
问题描述
我读的文档中的以下内容:
I am reading the following in the documentation:
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?
Can someone tell me. Where does the cache data get stored? Also what is the advantage in using $cacheFactory and how do I use a custom cache factory with HTTP ?
推荐答案
1)的数据存储在内存中(例如在浏览器中)
1) The data are stored in memory (e.g. in your browser)
2)您避免做对同一资源的多个服务器请求(例如模板文件)
2) You avoid doing multiple server request for the same resource (for example template files)
3)于:var 缓存= $ cacheFactory('yourCacheId');
您可以创建自己的高速缓存。这样做的advatage可能是,你可以清除特定的资源缓存( cache.removeAll
)。
3) With: var cache = $cacheFactory('yourCacheId');
you may create your own cache. The advatage of this could be, that you can clear the cache for specific resources ( cache.removeAll
).
数独: http://docs.angularjs.org/api/ng.$cacheFactory
这篇关于哪里的AngularJS HTTP存储对象,他们被缓存的时候?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!