{"id":18498916,"url":"https://github.com/sjdonado/cache-manager-bun-sqlite3","last_synced_at":"2025-04-09T00:31:28.189Z","repository":{"id":249549187,"uuid":"831821360","full_name":"sjdonado/cache-manager-bun-sqlite3","owner":"sjdonado","description":"Fast and compact sqlite3 cache store for Bun","archived":false,"fork":false,"pushed_at":"2024-07-23T06:22:55.000Z","size":170,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T19:10:06.203Z","etag":null,"topics":["bun-sqlite","cache-manager"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/cache-manager-bun-sqlite3","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/sjdonado.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-21T17:48:30.000Z","updated_at":"2024-12-27T20:02:16.000Z","dependencies_parsed_at":"2024-07-21T19:41:07.495Z","dependency_job_id":"fa59145a-e8a2-40ab-abb4-17d9d66ee93c","html_url":"https://github.com/sjdonado/cache-manager-bun-sqlite3","commit_stats":null,"previous_names":["sjdonado/cache-manager-bun-sqlite"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjdonado%2Fcache-manager-bun-sqlite3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjdonado%2Fcache-manager-bun-sqlite3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjdonado%2Fcache-manager-bun-sqlite3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjdonado%2Fcache-manager-bun-sqlite3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sjdonado","download_url":"https://codeload.github.com/sjdonado/cache-manager-bun-sqlite3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247949929,"owners_count":21023413,"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":["bun-sqlite","cache-manager"],"created_at":"2024-11-06T13:43:00.163Z","updated_at":"2025-04-09T00:31:25.743Z","avatar_url":"https://github.com/sjdonado.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bun SQLite Store for [node-cache-manager](https://github.com/BryanDonovan/node-cache-manager)\n\n- Runs on top of [bun-sqlite](https://bun.sh/docs/api/sqlite)\n- Optimized `mset`/`mget` support\n- Multiple encoders support: `msgpackr`, `cbor`, `json`\n- Auto purge (clean expired records every hour)\n\n## Installation\n\n```\nbun add cache-manager-bun-sqlite3\n```\n\n## Usage\n\n### Single store\n\n```ts\nimport cacheManager from 'cache-manager';\nimport bunSqliteStore from 'cache-manager-bun-sqlite3';\n\n// SQLite :memory: cache store\ncache = await cacheManager.caching(bunSqliteStore, {\n  serializer: 'json', // default is 'msgpackr'\n  ttl: 20, // TTL in seconds\n});\n\n// On-disk cache on employees table\nconst cache = await cacheManager.caching(bunSqliteStore, {\n  name: 'employees',\n  path: '/tmp/cache.db',\n});\n\n// TTL in seconds\nawait cache.set('foo', { test: 'bar' }, 30);\nconst value = await cache.get('foo');\n\n// TTL in seconds\nawait cache.set('foo', { test: 'bar' }, 30);\nconst value = await cache.get('foo');\n```\n\n### Multi-store example:\n\n```ts\nimport cacheManager from 'cache-manager';\nimport bunSqliteStore from 'cache-manager-bun-sqlite3';\nimport redisStore from 'cache-manager-ioredis';\n\nconst redisCache = await cacheManager.caching({ store: redisStore, db: 0, ttl: 600 });\nconst sqliteCache = await cacheManager.caching({\n  store: sqliteStore,\n  path: '/tmp/cache.db',\n  name: 'users',\n  ttl: 600,\n});\n\nconst multiCache = cacheManager.multiCaching([sqliteCache, redisCache]);\n\n// Basic get/set\nawait multiCache.set('foo2', 'bar2', customTTL);\nconst v = await multiCache.get('foo2');\n\n// Wrap call example\nconst userId = 'user-1';\n\n// Optionally pass ttl\nawait multiCache.wrap(userId, customTTL, async () =\u003e {\n  console.log('Calling expensive service');\n  await getUserFromExpensiveService(userId);\n});\n\n// set and get multiple\nawait multiCache.mset('foo1', 'bar1', 'foo0', 'bar0'); //Uses default TTL\nawait multiCache.mset('foo1', 'bar1', 'foo3', 'bar3', customTTL);\nawait multiCache.mget('foo1', 'foo3');\n```\n\nFork from [node-cache-manager-sqlite](https://github.com/maxpert/node-cache-manager-sqlite)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjdonado%2Fcache-manager-bun-sqlite3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsjdonado%2Fcache-manager-bun-sqlite3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjdonado%2Fcache-manager-bun-sqlite3/lists"}