[AngualrJS] Using Angular-Cache for caching http request
Check the website: https://jmdobry.github.io/angular-cache/#using-angular-cache-with-http
Install:
npm install --save angular-cache
getServiceDetail( serviceId = "mock" ) {
if(!this.CacheFactory.get(`${this.prefix}.${serviceId}`)){
this.$http.defaults.cache = this.CacheFactory(`${this.prefix}.${serviceId}`, {
maxAge: 15 * 60 * 1000, // Items added to this cache expire after 15 minutes
cacheFlushInterval: 60 * 60 * 1000, // This cache will clear itself every hour
deleteOnExpire: 'aggressive' // Items will be deleted from this cache when they expire
});
}
return this.$http.get( `${this.CONFIG.BACKEND_API_URL}/services/${serviceId}/details`,
{
cache: this.CacheFactory.get(`${this.prefix}.${serviceId}`)
} )
.then( ( res ) => {
return res.data.serviceDetail;
}, ( err ) => {
this.$log.debug( `ServiceDetails --> getServiceDetail err: Cannnot get detail data: ${JSON.stringify( err, null, 3 )}` );
throw err;
} );
}
}
[AngualrJS] Using Angular-Cache for caching http request的更多相关文章
- Data caching per request in Owin application
Data caching per request in Owin application 解答1 Finally I found OwinRequestScopeContext. Very simpl ...
- spring cloud Bug之was unable to refresh its cache! status = Cannot execute request on any known server
可能原因: 1.application.yml server: port: 10001spring: application: name: microservice-consumer-movieeur ...
- was unable to refresh its cache! status = Cannot execute request on any known server
出现这种错误是因为: Eureka服务注册中心也会将自己作为客户端来尝试注册它自己,所以我们需要禁用它的客户端注册行为. 在 yml中设置 eureka.client.register-with-eu ...
- [转] KVM storage performance and cache settings on Red Hat Enterprise Linux 6.2
Almost one year ago, I checked how different cache settings affected KVM storage subsystem performan ...
- [转] KVM I/O slowness on RHEL 6
KVM I/O slowness on RHEL 6 http://www.ilsistemista.net/index.php/virtualization/11-kvm-io-slowness-o ...
- http header cache-control (request和response区别)
摘要:(1)网络服务会根据 request的header中的 cache-control策略设置response的cache-control策略 1 response cache-control 和 ...
- 请求方式:request和 get、post、put
angular 的 http 多了 Request, Headers, Response ,这些都是游览器的"新特性" Fetch API. Fetch API 和以前的 xmlh ...
- Page.Cache
https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.page.cache?view=netframework-4.8 Gets the ...
- 025-缓存Cache
如果每次进入页面的时候都查询数据库生成页面内容的话,如果访问量非常大,则网站性能会非常差.而如果只有第一次访问的时候才查询数据库生成页面内容,以后都直接输出内容,则能提高系统性能.这样无论有多少人访问 ...
随机推荐
- 使用Gradle构建Android应用内测版本
在开发应用的过程中,有时候需要比较当前线上版本和正在开发中的版本差异,目前的做法只能是在两个不同的设备上面安装线上版本和开发中的版本,因为当前版本在调试过程中会覆盖旧版本.本文通过使用gradle来构 ...
- EF加载实体的方式
原文:Loading Related Entities EF加载数据的方式: 预加载 eager loading 延迟加载 lazy loading 显示加载 explicit loading 预先加 ...
- WPF XAML之bing使用StringFormat(转)
释义 BindingBase.StringFormat 属性 获取或设置一个字符串,该字符串指定如果绑定值显示为字符串,应如何设置该绑定的格式. 命名空间: System.Windows ...
- system进程启动普通用户进程调研
system进程启动普通用户进程 关键函数是CreateProcessAsUser 主要思路是先取得目的用户的token,然后用上面的函数启动 1.从explorer中取token BOOL GetT ...
- CF 8D Two Friends 【二分+三分】
三个地点构成一个三角形. 判断一下两个人能否一起到shop然后回家,如果不能: 两个人一定在三角形内部某一点分开,假设沿着直线走,可以将问题简化. 三分从电影院出来时候的角度,在对应的直线上二分出一个 ...
- PHP连接Microsoft SQL Server 2005/2008
PHP自带的MSSQL扩展php_mssql.dll原来是给SQL Server 2000用的,难怪连接不上2008?! -_-!!要使用SQL Server 2005以上版本,就要用到微软为PHP提 ...
- 【android】修改android默认应用图标
我自己做的一个小程序,想更改程序安装后的默认显示图片,但是我发现只能改一次,以后再改还是显示第一次更改后的图片(此时我已把最后一次更改前的全部图片都删除了,所以不会是名称填错),这是为什么??求高人指 ...
- DNF(一.YUM已死,DNF代之)
Yum还没学好呢,突然听到已经要被抛弃了.恐慌至极.. 在最新版的Fedora 22 抛弃了Yum包管理器,取而代之的是DNF.. 那么搜搜 Fedora 22 Release Note.. 官方给出 ...
- 方便代理下单的EcStore收货地址一键分析插件,同时支持淘宝/京东/一号店
使用EcStore开展分销的网站,代理需要经常代客下单,每个客户收货地址都不同,要选择和填写多个内容才能完成地址输入:省.市.区.详细地址.收货人姓名.手机电话等,非常麻烦,也容易输入错误.安装EcS ...
- MVC 学习随笔(一)
Model的绑定. (一)使用NameValueCollectionValueProvider C# 对NameValueCollectionValueProvider的支持是通过下面的类实现的 // ...