哪里的AngularJS HTTP存储对象,他们被缓存的时候? [英] Where does the AngularJS HTTP store objects when they are cached?

查看:138
本文介绍了哪里的AngularJS HTTP存储对象,他们被缓存的时候?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读的文档中的以下内容:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆