{"id":37429993,"url":"https://github.com/hexindai/egg-cache","last_synced_at":"2026-01-16T06:34:15.401Z","repository":{"id":56458568,"uuid":"127786076","full_name":"hexindai/egg-cache","owner":"hexindai","description":"💾 Cache plugin for eggjs","archived":false,"fork":false,"pushed_at":"2020-11-04T11:33:09.000Z","size":90,"stargazers_count":64,"open_issues_count":1,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-14T07:53:50.992Z","etag":null,"topics":["egg-cache","egg-plugin","eggjs"],"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/hexindai.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":"2018-04-02T17:01:09.000Z","updated_at":"2024-04-26T15:07:06.000Z","dependencies_parsed_at":"2022-08-15T19:10:25.588Z","dependency_job_id":null,"html_url":"https://github.com/hexindai/egg-cache","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/hexindai/egg-cache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexindai%2Fegg-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexindai%2Fegg-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexindai%2Fegg-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexindai%2Fegg-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hexindai","download_url":"https://codeload.github.com/hexindai/egg-cache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexindai%2Fegg-cache/sbom","scorecard":{"id":462864,"data":{"date":"2025-08-11","repo":{"name":"github.com/hexindai/egg-cache","commit":"37cdb2e5e73c8e1e5a103861c21d1cbb6fe33409"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"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":1,"reason":"Found 3/16 approved changesets -- score normalized to 1","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":"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":"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":"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":"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":"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":"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":"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":"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"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 20 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T11:37:34.820Z","repository_id":56458568,"created_at":"2025-08-19T11:37:34.820Z","updated_at":"2025-08-19T11:37:34.820Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28477855,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: 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":["egg-cache","egg-plugin","eggjs"],"created_at":"2026-01-16T06:34:15.323Z","updated_at":"2026-01-16T06:34:15.391Z","avatar_url":"https://github.com/hexindai.png","language":"JavaScript","readme":"# egg-cache\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![David deps][david-image]][david-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/egg-cache.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/egg-cache\n[travis-image]: https://img.shields.io/travis/hexindai/egg-cache.svg?style=flat-square\n[travis-url]: https://travis-ci.org/hexindai/egg-cache\n[codecov-image]: https://img.shields.io/codecov/c/github/hexindai/egg-cache.svg?style=flat-square\n[codecov-url]: https://codecov.io/github/hexindai/egg-cache?branch=master\n[david-image]: https://img.shields.io/david/hexindai/egg-cache.svg?style=flat-square\n[david-url]: https://david-dm.org/hexindai/egg-cache\n[snyk-image]: https://snyk.io/test/npm/egg-cache/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/egg-cache\n[download-image]: https://img.shields.io/npm/dm/egg-cache.svg?style=flat-square\n[download-url]: https://npmjs.org/package/egg-cache\n\nBased on [cache-manager](https://github.com/BryanDonovan/node-cache-manager)\n\nAll store engine based on [cache-manager](https://github.com/BryanDonovan/node-cache-manager) can be used.\n* [Store engine](https://github.com/BryanDonovan/node-cache-manager#store-engines)\n* [Configuration reference](#add-store)\n\n[中文文档](README.zh_CN.md)\n\n## Installation\n\n```sh\nnpm i egg-cache -S\n```\n\nor\n\n```sh\nyarn add egg-cache\n```\n\n## Configuration\n\n```js\n// config/plugin.js\nexports.cache = {\n  enable: true,\n  package: 'egg-cache',\n};\n```\n\n```js\n// config/config.default.js\nexports.cache = {\n  default: 'memory',\n  stores: {\n    memory: {\n      driver: 'memory',\n      max: 100,\n      ttl: 0,\n    },\n  },\n};\n```\n## Usage\n\n```js\nawait app.cache.set('foo', 'bar', 60, { foo: 'bar' });\n\nawait app.cache.get('foo'); // 'bar'\n\nawait app.cache.has('foo'); // true\n\nawait app.cache.del('foo');\nawait app.cache.get('foo', 'default');  // 'default'\n\nawait app.cache.has('foo'); // false\n\n// closure\nawait app.cache.set('foo', () =\u003e {\n  return 'bar';\n}); // 'bar'\n\n// Promise\nawait app.cache.set('foo', () =\u003e {\n  return Promise.resolve('bar');\n});  // 'bar'\n\n// Get cached value. If it's not existed, get and save the value from closure\nawait app.cache.get('foo', () =\u003e {\n  return 'bar';\n}); // 'bar'\n\n// You can declare an `expire` option\nawait app.cache.get('foo', () =\u003e {\n  return 'bar';\n}, 60, {\n  foo: 'bar'\n});\n\n//  foo was cached\nawait app.cache.get('foo'); // 'bar'\n\n// clear cache\nawait app.cache.reset();\n```\n\n### Add store\n\n1. config: the `store` in the configuration uses the `driver` instead.\n\n```js\n// config/config.default.js\n\nconst redisStore = require('cache-manager-ioredis');\n\nexports.cache = {\n  default: 'memory',\n  stores: {\n    memory: {\n      driver: 'memory',\n      max: 100,\n      ttl: 0,\n    },\n    redis: { // full config: https://github.com/dabroek/node-cache-manager-ioredis#single-store\n      driver: redisStore,\n      host: 'localhost',\n      port: 6379,\n      password: '',\n      db: 0,\n      ttl: 600,\n      valid: _ =\u003e _ !== null,\n    },\n  },\n};\n```\n\n2. usage\n\n```js\nconst store = app.cache.store('redis');\n\nawait store.set('foo', 'bar');\nawait store.get('foo'); // 'bar'\n\nawait store.del('foo');\nawait store.has('foo'); // false\n```\n\n### Api\n\n#### cache.set(name, value, [expire=null, options=null]);\n\nSet Cache\n - `name` cache name\n - `value` cache value\n - `expire` (Optional) expire（default from config file，the unit is second， `0` means *nerver* expire）\n - `options` (Optional) Refer to [cache-manager](https://github.com/BryanDonovan/node-cache-manager/blob/master/lib/stores/memory.js#L14-L18))\n\n#### cache.get(name, [defaultValue=null, expire=null, options=null]);\n\n#### cache.del(name);\n\n#### cache.has(name);\n\n#### cache.store(name, [options=null]);\n\n#### cache.reset();\n\n## Default configuration\n\nRefer to [config/config.default.js](config/config.default.js)\n\n## Unit Test\n\n```sh\nnpm test\n```\n\n## Issue\n\nRefer to [Issues](https://github.com/hexindai/egg-cache/issues).\n\n## License\n\n[MIT](LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexindai%2Fegg-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhexindai%2Fegg-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexindai%2Fegg-cache/lists"}