{"id":24290529,"url":"https://github.com/dutu/time-limited-map-set","last_synced_at":"2026-06-09T14:31:39.471Z","repository":{"id":37434044,"uuid":"505795327","full_name":"dutu/time-limited-map-set","owner":"dutu","description":"time limited map and set","archived":false,"fork":false,"pushed_at":"2022-08-03T11:19:49.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-06T02:32:31.077Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/time-limited-map-set","language":"JavaScript","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/dutu.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}},"created_at":"2022-06-21T10:29:09.000Z","updated_at":"2022-07-11T10:47:40.000Z","dependencies_parsed_at":"2022-07-12T14:03:05.606Z","dependency_job_id":null,"html_url":"https://github.com/dutu/time-limited-map-set","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/dutu/time-limited-map-set","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dutu%2Ftime-limited-map-set","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dutu%2Ftime-limited-map-set/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dutu%2Ftime-limited-map-set/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dutu%2Ftime-limited-map-set/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dutu","download_url":"https://codeload.github.com/dutu/time-limited-map-set/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dutu%2Ftime-limited-map-set/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34112225,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"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-01-16T11:53:09.196Z","updated_at":"2026-06-09T14:31:39.448Z","avatar_url":"https://github.com/dutu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"time-limited-map-set\n====\n[![Build Status](https://travis-ci.com/dutu/time-limited-map-set.svg?branch=master)](https://travis-ci.com/dutu/time-limited-map-set)  \n\nExtend `Map` and `Set` standard build-in objects, with the options for the collection items to be automatically removed after a period of time.\n\n`TimeLimitedMap` and `TimeLimitedSet` inherit all methods of `Map` and `Set` standard build-in objects.\n\nExamples:\n```js\nconst map = new TimeLimitedMap(1000, (k, v, insertedMts) =\u003e console.log(k))\n\n// add a new pair to the map\n// it will be automatically removed after 1000 milliseconds and the callback function will be called \nmap.set('key', 'value')\n\nconst set = new TimeLimitedSet(500)\n\n// add a new item to the set\n// it will be automatically removed after 500 milliseconds \nset.add('item')\n\n// add a new item to the set, which will not be removed automatically\nset.add('item2', false)\n```\n\n## Constructor\n\n### `new TimeLimitedMap([expiryMs] [, callback] [, iterable])`\n### `new TimeLimitedSet([expiryMs] [, callback] [, iterable])`\n\nOptional parameters can be passed to the constructor:\n* `expiryMs` - Indicates the duration in milliseconds after which the items are automatically removed from the collection. If `undefined` items are not removed from the collection.\n* `callback` - Function to be called when an expired item is removed from the collection.\n   The function is called with parameters `key`, `value` (only for `TimeLimitedMap`) and `mts` (inserted millisecond-timestamp).\n* `iterable` - As for the `Map` and `Set` build-in objects, an iterable whose elements are added to the collection.\n\n\n## Methods\n\n`TimeLimitedMap` and `TimeLimitedSet` inherit all methods of `Map` and `Set` standard build-in objects.\n\n### Changed methods:\n\n### `set(key, value, [expire = true])`\n * `expire` - Additional optional parameter. Indicates whether the item should or should not be removed after `expiryMs` period has passed. Default is `true`.\n\n### `add(value, [expire = true])`\n* `expire` - Additional optional parameter. Indicates whether the item should or should not be removed after `expiryMs` period has passed. Default is `true`.\n\n### New Methods:\n### `getExpiryMts(key)`\nReturns expiry millisecond-time of a particular item in the collection.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdutu%2Ftime-limited-map-set","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdutu%2Ftime-limited-map-set","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdutu%2Ftime-limited-map-set/lists"}