{"id":27977309,"url":"https://github.com/labd/dataloader-cache-wrapper","last_synced_at":"2026-03-01T04:37:53.555Z","repository":{"id":165462463,"uuid":"640805574","full_name":"labd/dataloader-cache-wrapper","owner":"labd","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-30T18:49:18.000Z","size":214,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-12-02T09:32:15.921Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/labd.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2023-05-15T07:02:50.000Z","updated_at":"2025-04-30T18:48:34.000Z","dependencies_parsed_at":"2023-11-15T21:31:32.199Z","dependency_job_id":"0e2a88c3-fafa-404a-a718-448ac89bf9b1","html_url":"https://github.com/labd/dataloader-cache-wrapper","commit_stats":null,"previous_names":["labd/dataloader-cache-wrapper"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/labd/dataloader-cache-wrapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labd%2Fdataloader-cache-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labd%2Fdataloader-cache-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labd%2Fdataloader-cache-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labd%2Fdataloader-cache-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/labd","download_url":"https://codeload.github.com/labd/dataloader-cache-wrapper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labd%2Fdataloader-cache-wrapper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29960253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T01:47:18.291Z","status":"online","status_checked_at":"2026-03-01T02:00:07.437Z","response_time":124,"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":[],"created_at":"2025-05-08T01:48:14.545Z","updated_at":"2026-03-01T04:37:53.537Z","avatar_url":"https://github.com/labd.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-dataloader-cache-wrapper\n\n\n## Usage\n```ts\nimport { DataLoaderCache } from \"@labdigital/dataloader-cache-wrapper\"\n\nconst loader = new DataLoaderCache\u003cProductReference, any\u003e(ProductDataLoader, {\n\tcache: {\n\t\tstoreFn: () =\u003e new Keyv(),\n\t\tttl: 3600,\n\t},\n\tcacheKeyFn: (ref: ProdProductReferenceuctRef) =\u003e {\n\t\tconst key = `${ref.store}-${ref.locale}-${ref.currency}`;\n\t\treturn `some-data:${key}:id:${ref.slug}`\n\t},\n\tmaxBatchSize: 50,\n});\n\n```\n\nOr use the older API with the `dataloaderCache` function:\n\n```ts\nimport { dataloaderCache } from \"@labdigital/dataloader-cache-wrapper\"\n\nexport const createProductBySlugLoader = () =\u003e {\n  return new DataLoader\u003cProductReference, any\u003e(ProductDataLoader, {\n    maxBatchSize: 50,\n  });\n};\n\nexport const ProductDataLoader = async (keys: readonly any[]): Promise\u003c(Product | null)[]\u003e =\u003e {\n  return dataloaderCache(_uncachedProductDataLoader, keys, {\n    store: new Keyv(),\n    ttl: 3600,\n\n    cacheKeysFn: (ref: ProductReference) =\u003e {\n      const key = `${ref.store}-${ref.locale}-${ref.currency}`;\n      return [`some-data:${key}:id:${ref.slug}`];\n    },\n  })\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabd%2Fdataloader-cache-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flabd%2Fdataloader-cache-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabd%2Fdataloader-cache-wrapper/lists"}