{"id":15608337,"url":"https://github.com/ritikesh/memoize_until","last_synced_at":"2025-04-28T11:41:22.110Z","repository":{"id":34258596,"uuid":"174015490","full_name":"ritikesh/memoize_until","owner":"ritikesh","description":"A unique Memoization Pattern, rewritten in typescript. Original at https://github.com/freshworks/memoize_until","archived":false,"fork":false,"pushed_at":"2023-10-19T14:16:07.000Z","size":974,"stargazers_count":5,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-08T10:53:53.063Z","etag":null,"topics":["cachemanager","javascript","memoization","ttl-cache-implementation","typescript"],"latest_commit_sha":null,"homepage":"","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/ritikesh.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-05T20:24:40.000Z","updated_at":"2023-01-07T19:08:29.000Z","dependencies_parsed_at":"2025-03-07T20:41:03.692Z","dependency_job_id":null,"html_url":"https://github.com/ritikesh/memoize_until","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ritikesh%2Fmemoize_until","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ritikesh%2Fmemoize_until/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ritikesh%2Fmemoize_until/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ritikesh%2Fmemoize_until/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ritikesh","download_url":"https://codeload.github.com/ritikesh/memoize_until/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251306675,"owners_count":21568316,"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":["cachemanager","javascript","memoization","ttl-cache-implementation","typescript"],"created_at":"2024-10-03T05:20:24.522Z","updated_at":"2025-04-28T11:41:22.085Z","avatar_url":"https://github.com/ritikesh.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MemoizeUntil\n[![CircleCI](https://dl.circleci.com/status-badge/img/gh/ritikesh/memoize_until/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/ritikesh/memoize_until/tree/master)\n![Version](https://img.shields.io/npm/v/memoize_until.svg)\n![Downlaods](https://img.shields.io/npm/dt/memoize_until.svg)\n\nA unique Memoization Pattern which memoizes until the next time metric - could be until the next minute, hour, day, week.\n\n## Get Started\n\nInstall `memoize_until` with: \n\n```bash\nnpm install memoize_until --save-dev\n```\n\n## Usage\n\n```javascript\nconst MemoizeUntil = require('memoize_until').MemoizeUntil\n\nMemoizeUntil.fetch('min', 'default', () =\u003e { \n    return 'SomeComplexOperation'; \n})\n```\n\n#### options:\n1. `min` : Metric until when you want to memoize. Can be one of ['min', 'hour', 'day', 'week']\n\n2. `default` : All metric levels come with a 'default' key. More can be added by [initializing](#Initialisation) `MemoizeUntil` with extra keys\n\n3. `cb`: callback function. This callback function must return a value which needs to be memoized/cached.\n\n## Initialisation\nTo add custom keys to each metric, pass a custom object to the `init` function of `MemoizeUntil`.\n```javascript\nMemoizeUntil.init({ \n    min: ['custom1', 'custom2']\n})\n\nMemoizeUntil.fetch('min', 'custom1', () =\u003e { \n    return 'SomeComplexOperation'; \n})\n```\n\n## Extend\nTo add custom keys during runtime to any metric, use the `extend` function of `MemoizeUntil`.\n```javascript\nlet runtime_key = 'runtime_key';\nMemoizeUntil.extend('min', runtime_key)\n\nMemoizeUntil.fetch('min', runtime_key, () =\u003e { \n    return 'SomeComplexOperation'; \n})\n```\n\n## Nulls\nif the value to be memoized is `undefined` or `null`, `MemoizeUntil` wraps it underneath a pseudo null-like object called `NullObject` and always returns `undefined`. This ensures that even nulls are memoized.\n\n## License\n[Ritikesh](https://ritikesh.github.io)  \nLicensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fritikesh%2Fmemoize_until","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fritikesh%2Fmemoize_until","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fritikesh%2Fmemoize_until/lists"}