我可以在浏览器中缓存列表项吗? [英] Can I cache list items in browser?

查看:59
本文介绍了我可以在浏览器中缓存列表项吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对多个SP列表进行了REST调用,并使用客户端代码将项目取回.我可以在浏览器中缓存这些项目一天吗?这样我就避免了调用REST调用,这既复杂又费时?谢谢

I did a REST call to multiple SP lists and got the items back using client code. Can I cache these items in the browser for a day? So that I avoid invoking REST call which is complex and time consuming? Thanks

推荐答案

绝对可以使用本地存储将其缓存在浏览器中,并可以在代码中对其进行控制.请尝试使用此代码段.

Absolutely you can cache it on your browser using local storage and can control them in your code.try this snippet.


.getJSON('http://restapiendpoint',函数(数据){ localStorage.setItem('key',JSON.stringify(data));
.getJSON('http://restapiendpoint', function (data) { localStorage.setItem('key', JSON.stringify(data));


这篇关于我可以在浏览器中缓存列表项吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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