{"id":15132566,"url":"https://github.com/tiagoguirra/cache-on-redis","last_synced_at":"2026-02-09T17:36:02.070Z","repository":{"id":57192478,"uuid":"299642903","full_name":"tiagoguirra/cache-on-redis","owner":"tiagoguirra","description":"Cache on redis is a simple library to temporary storage cache using node.js and redis.","archived":false,"fork":false,"pushed_at":"2022-01-04T18:01:04.000Z","size":79,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-14T16:17:48.347Z","etag":null,"topics":["cache","redis"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tiagoguirra.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-29T14:28:29.000Z","updated_at":"2022-12-12T12:25:26.000Z","dependencies_parsed_at":"2022-08-24T05:21:15.701Z","dependency_job_id":null,"html_url":"https://github.com/tiagoguirra/cache-on-redis","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tiagoguirra/cache-on-redis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiagoguirra%2Fcache-on-redis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiagoguirra%2Fcache-on-redis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiagoguirra%2Fcache-on-redis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiagoguirra%2Fcache-on-redis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tiagoguirra","download_url":"https://codeload.github.com/tiagoguirra/cache-on-redis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiagoguirra%2Fcache-on-redis/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267327562,"owners_count":24069451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cache","redis"],"created_at":"2024-09-26T04:20:55.185Z","updated_at":"2026-02-09T17:35:57.048Z","avatar_url":"https://github.com/tiagoguirra.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cache-on-redis\n\nCache on redis is a simple library to temporary storage cache using node.js and redis.\n\n## Install\n\n```bash\n$ npm install cache-on-redis\n```\n\n## Usage\n\nThen create a cache-on-redis instance passing redis options:\n\n```javascript\nconst { CacheOnRedis } = require('cache-on-redis')\nconst cache = new CacheOnRedis({\n  host: 'localhost',\n  port: 6379,\n  connect_timeout: 3600000,\n  retry_strategy: (options) =\u003e {\n    return 2000\n  },\n})\n```\n\n##### Set cache value\n\nCreate a cache from json object\n\n```javascript\nawait cache.setJson('myCacheKey', {\n  name: 'Redis cache',\n  version: 'beta',\n})\n```\n\nCreate a cache from string\n\n```javascript\nawait cache.set('myCacheKey', 'storage this')\n```\n\n##### Get cache value\n\nGet a cache json object\n\n```javascript\nawait cache.getJson('myCacheKey')\n```\n\nGet a cache string\n\n```javascript\nawait cache.get('myCacheKey')\n```\n\n##### Invalidate\n\nTo invalidate cache\n\n```javascript\nawait cache.invalidate('myCacheKey')\n```\n\nTo invalidate cache using patterns\n\n```javascript\nawait cache.invalidate('myCa*', true)\n```\n\n#### `options` object properties\n\nThe cache instance acceps a options argument:\n\n- `CacheOnRedis(redisInstance,options)`\n\n| Property    | Default | Description                                                    |\n| ----------- | ------- | -------------------------------------------------------------- |\n| key_prefix  | cache   | Cache key prefix, every cache storage will contain this prefix |\n| expire_time | 3600    | Cache expiration time in secconds                              |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiagoguirra%2Fcache-on-redis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftiagoguirra%2Fcache-on-redis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiagoguirra%2Fcache-on-redis/lists"}