{"id":32265806,"url":"https://github.com/wqteam/jquery-ajax-cache","last_synced_at":"2026-02-19T21:02:51.534Z","repository":{"id":57281963,"uuid":"43864159","full_name":"WQTeam/jquery-ajax-cache","owner":"WQTeam","description":" A jQuery plugin, for cache the AJAX with 'localStorage' or  'sessionStorage'.","archived":false,"fork":false,"pushed_at":"2018-01-23T01:11:52.000Z","size":165,"stargazers_count":56,"open_issues_count":4,"forks_count":22,"subscribers_count":12,"default_branch":"master","last_synced_at":"2026-01-24T04:48:53.231Z","etag":null,"topics":["ajax","localstorage","sessionstorage"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WQTeam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-08T05:05:31.000Z","updated_at":"2025-08-27T12:08:02.000Z","dependencies_parsed_at":"2022-08-31T00:01:59.434Z","dependency_job_id":null,"html_url":"https://github.com/WQTeam/jquery-ajax-cache","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/WQTeam/jquery-ajax-cache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WQTeam%2Fjquery-ajax-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WQTeam%2Fjquery-ajax-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WQTeam%2Fjquery-ajax-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WQTeam%2Fjquery-ajax-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WQTeam","download_url":"https://codeload.github.com/WQTeam/jquery-ajax-cache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WQTeam%2Fjquery-ajax-cache/sbom","scorecard":{"id":149407,"data":{"date":"2025-08-11","repo":{"name":"github.com/WQTeam/jquery-ajax-cache","commit":"aee80fe5f63a7cd2ccd48fa5a423f0a496ee0b46"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-16T10:11:11.147Z","repository_id":57281963,"created_at":"2025-08-16T10:11:11.147Z","updated_at":"2025-08-16T10:11:11.147Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29632708,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T18:02:07.722Z","status":"ssl_error","status_checked_at":"2026-02-19T18:01:46.144Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ajax","localstorage","sessionstorage"],"created_at":"2025-10-22T21:19:53.557Z","updated_at":"2026-02-19T21:02:51.530Z","avatar_url":"https://github.com/WQTeam.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jquery-ajax-cache\n[![Build Status](https://travis-ci.org/WQTeam/jquery-ajax-cache.svg)](https://travis-ci.org/WQTeam/jquery-ajax-cache)\n[![npm](https://img.shields.io/npm/dt/jquery-ajax-cache.svg)](https://www.npmjs.com/package/jquery-ajax-cache)\n\n## Language\n[English Document](./README_EN.md)\n\n\n\u003cb\u003ejquery-ajax-cache 插件\u003c/b\u003e扩展了jQuery的`$.ajax`，提供非常便利的方式缓存ajax请求到‘localStorage’或‘sessionStorage’中。你唯一要做的就是实现`cacheValidate`方法，验证返回结果是否需要缓存。页面加载和数据读写过程插件都会进行过期数据清除，避免过期数据的堆积。同时你也可以调用`$ajaxCache.deleteAllExpires()`手动清除过期缓存。\n\n\n# Why jquery-ajax-cache？\n### 优点  \n\n1、使用简单！  \n2、还是使用简单！！  \n3、重要事情3遍，简单！！！  \n4、最大可能的清除过期数据，避免溢出  \n\n# 下载\n[下载](https://github.com/WQTeam/jquery-ajax-cache/releases) 最新 jquery-ajax-cache\n\nbower\n```javascript\nbower install jquery-ajax-cache\n```\nnpm\n```javascript\nnpm install jquery-ajax-cache --save-dev\n```\n\n\n# 引入\n```html\n\u003cscript src=\"../node_modules/jquery/dist/jquery.js\"\u003e\u003c/script\u003e\n\u003cscript src='../dist/jquery-ajax-cache.min.js'\u003e\u003c/script\u003e\n```\n\n# 使用\n因为在实际应用中，后台返回的结果可能是成功信息，也有可能是失败信息。所以只有业务上我们认为成功的请求我们才需要缓冲起来。jquery-ajax-cache插件预留了一个方法`cacheValidate`给使用者作为判断请求是否成功。  \n\n### 全局配置`cacheValidate`(该方法需要全局调用一次)\n```javascript\n$ajaxCache.config({\n    // 业务逻辑判断请求是否缓存， res为ajax返回结果, options 为 $.ajax 的参数\n    cacheValidate: function (res, options) {    //选填，配置全局的验证是否需要进行缓存的方法,“全局配置” 和 ”自定义“，至少有一处实现cacheValidate方法\n\n        return true;  // 所有情况都缓存\n\n        // return res.state === 'ok'; // 满足某个条件才缓存\n\n        // return false; // 不缓存\n    },\n    storageType: 'localStorage', //选填，‘localStorage’ or 'sessionStorage', 默认‘localStorage’\n    timeout: 60 * 60, //选填， 单位秒。默认1小时\n});\n\n$.ajax({\n    // 使用时 只要增加给ajax请求增加一行属性   ajaxCache: true\n    ajaxCache: true     // “全局配置” 和 ”自定义“，至少有一处实现cacheValidate方法\n    /*\n     others...\n    */\n});\n\n```\n\n### 自定义单个请求的`cacheValidate`\n```javascript\n$.ajax(\n    // 此处的参数会覆盖‘全局配置’中的设置\n    ajaxCache: {\n        // 业务逻辑判断请求是否缓存， res为ajax返回结果, options 为 $.ajax 的参数\n        cacheValidate: function (res, options) { //选填，配置全局的验证是否需要进行缓存的方法, “全局配置” 和 ”自定义“，至少有一处实现cacheValidate方法\n\n            return true;  // 所有情况都缓存\n\n            // return res.state === 'ok'; // 满足某个条件才缓存\n\n            // return false; // 不缓存\n        },\n        storageType: 'localStorage', //选填，‘localStorage’ or 'sessionStorage', 默认‘localStorage’\n        timeout: 60 * 60, //选填， 单位秒。默认1小时,\n        forceRefresh: false //选填，默认false 是否强制刷新请求。本次请求不读取缓存，同时如果请求成功会更新缓存。应用场景如：下拉刷新\n    }\n});\n```\n### 清除过期数据\n无特殊情况无需主动调用，插件会自动清除过期数据\n\n```javascript\n$ajaxCache.deleteAllExpires();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwqteam%2Fjquery-ajax-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwqteam%2Fjquery-ajax-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwqteam%2Fjquery-ajax-cache/lists"}