AngularJS $ HTTP缓存过期时间 [英] AngularJS $http cache expiration time
本文介绍了AngularJS $ HTTP缓存过期时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您可以设定一个到期时间为角的$ HTTP默认的缓存系统?
我想,一个URL保留在缓存中1分钟,这样,1分钟后向它提出的任何请求从服务器抓取新的数据。
Can you set an expiration time for Angular's $http default caching system ? I would like that an URL stays in the cache for 1 minute, so that any requests made to it after 1 minute grabs fresh data from the server.
推荐答案
有没有办法设置过期时间。但是你可以做手工。您可以访问$ HTTP缓存:
There is no way to set the expiration time. But you can do it manually. You have to access the $http cache:
var cache = $cacheFactory.get('$http');
和删除被缓存的网址:
cache.remove(theUrl);
请参阅文档以获取更多信息。
See documentation for more information.
这篇关于AngularJS $ HTTP缓存过期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文