jQuery AJAX 缓存插件 jquery-ajax-cache

码农软件 · 软件分类 · 其他jQuery插件 · 2020-01-03 12:44:31

软件介绍

jquery-ajax-cache 是 jQuery 插件——利用‘localStorage’ 和 ‘sessionStorage’ 对 jQuery AJAX 请求进行缓存。

引入

<script src="../node_modules/jquery/dist/jquery.js"></script>
<script src='../dist/jquery-ajax-cache.js'></script>

使用

全局配置

$ajaxCache.config({ cacheValidate: function (res) { //选填,配置全局的验证是否需要进行缓存的方法,“全局配置” 和 ”自定义“,至少有一处实现cacheValidate方法 return res.state === 'ok';
    },
    storageType: 'localStorage', //选填,‘localStorage’ or 'sessionStorage', 默认‘localStorage’ timeout: 60 * 60, //选填, 单位秒。默认1小时 });

简单使用

$.ajax({
    ajaxCache: true // “全局配置” 和 ”自定义“,至少有一处实现cacheValidate方法 /*  others...  */ });

自定义

$.ajax( // 此处的参数会覆盖‘全局配置’中的设置 ajaxCache: { cacheValidate: function (res) { //选填,配置全局的验证是否需要进行缓存的方法, “全局配置” 和 ”自定义“,至少有一处实现cacheValidate方法 return res.state === 'ok' && res.code ==='200';
        },
        storageType: 'localStorage', //选填,‘localStorage’ or 'sessionStorage', 默认‘localStorage’ timeout: 60 * 60, //选填, 单位秒。默认1小时 }
});

本文地址:https://codercto.com/soft/d/22567.html

任正非传

任正非传

孙力科 / 浙江人民出版社 / 2017-5-2 / 39.80

编辑推荐: 超权威、超丰富、超真实的任正非传记 亲述任正非跌宕起伏、传奇精彩的一生 ◆知名财经作家孙力科,历时十年,数十次深入华为,采访华为和任正非历程中各个关键人物,几度增删,创作成此书 ◆全书展现了任正非从出生至今70多年的人生画卷,从入伍到退役进国企,从艰难创业到开拓海外市场,囊括其人生道路上各个关键点,时间跨度之长,内容之丰富,前所未有 ◆迄今为止,任正非一生......一起来看看 《任正非传》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具