{"id":26121505,"url":"https://github.com/m4p4/nextjs-redis-cache","last_synced_at":"2025-03-10T14:23:26.036Z","repository":{"id":59506730,"uuid":"536249138","full_name":"M4p4/nextjs-redis-cache","owner":"M4p4","description":"Redis Cache for NextJs Framework to speedup your sites even more.","archived":false,"fork":false,"pushed_at":"2022-09-15T10:16:30.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-16T10:01:16.817Z","etag":null,"topics":["cache","inmemory-cache","next-cache","next-redis-cache","nextjs","nextjs-cache","redis","redis-cache"],"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/M4p4.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":"2022-09-13T17:58:45.000Z","updated_at":"2022-09-14T13:55:53.000Z","dependencies_parsed_at":"2022-09-18T07:35:49.764Z","dependency_job_id":null,"html_url":"https://github.com/M4p4/nextjs-redis-cache","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M4p4%2Fnextjs-redis-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M4p4%2Fnextjs-redis-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M4p4%2Fnextjs-redis-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/M4p4%2Fnextjs-redis-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/M4p4","download_url":"https://codeload.github.com/M4p4/nextjs-redis-cache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242865236,"owners_count":20197855,"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","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","inmemory-cache","next-cache","next-redis-cache","nextjs","nextjs-cache","redis","redis-cache"],"created_at":"2025-03-10T14:23:25.131Z","updated_at":"2025-03-10T14:23:26.029Z","avatar_url":"https://github.com/M4p4.png","language":"TypeScript","readme":"# Next.js Redis Cache\n\nA **Redis Cache** for **Next.js Framework** that supports expiration after a given time and also compress the data in memory. Perfect to speed up server side data collection even on a large scale.\n\n### Installation\n\n```\nnpm install nextjs-redis-cache\n```\n\n### How to use\n\n```ts\nimport cache from 'nextjs-redis-cache';\n\n// your redis client from redis package (createClient)\n// this should come from a singleton in your Next.js app!\nconst redisClient = createClient();\n\n// set\n// last param (options that also contain expireIn) is optional default is that it never expires!\nconst data = { foo: 'bar' };\nawait cache.set(redisClient, 'examplekey', data, { expireIn: 24 * 60 * 60 });\n\n// exists?\n// returns true or false\nconst res = await cache.exists(redisClient, 'examplekey');\n\n// get\n// returns decompressed and JSON.parsed object!\n// if there is non data for the given key it return null\nconst loadedData = await cache.get(redisClient, 'examplekey');\nif (loadedData) {\n  //... you can also use exists function to be sure cache exists\n}\n\n// delete\n// delete array of keys\nawait cache.delete(redisClient, ['examplekey', 'otherkey']);\n```\n\n**Note:** Your object will be stringified to a json string and then compressed with zlib. When you get the data from cache you will get your object back!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm4p4%2Fnextjs-redis-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm4p4%2Fnextjs-redis-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm4p4%2Fnextjs-redis-cache/lists"}