{"id":15673474,"url":"https://github.com/jwebcoder/metle","last_synced_at":"2025-05-06T22:42:15.736Z","repository":{"id":34932188,"uuid":"191975947","full_name":"JWebCoder/metle","owner":"JWebCoder","description":"memory storage with ttl and reset after request quantity","archived":false,"fork":false,"pushed_at":"2023-01-06T01:54:22.000Z","size":1191,"stargazers_count":3,"open_issues_count":11,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-29T14:17:37.611Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/JWebCoder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"jwebcoder","patreon":"jwebcoder","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2019-06-14T16:37:07.000Z","updated_at":"2021-06-03T17:23:58.000Z","dependencies_parsed_at":"2023-01-15T10:39:04.649Z","dependency_job_id":null,"html_url":"https://github.com/JWebCoder/metle","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JWebCoder%2Fmetle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JWebCoder%2Fmetle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JWebCoder%2Fmetle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JWebCoder%2Fmetle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JWebCoder","download_url":"https://codeload.github.com/JWebCoder/metle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252782441,"owners_count":21803378,"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":[],"created_at":"2024-10-03T15:40:51.591Z","updated_at":"2025-05-06T22:42:15.716Z","avatar_url":"https://github.com/JWebCoder.png","language":"JavaScript","funding_links":["https://github.com/sponsors/jwebcoder","https://patreon.com/jwebcoder"],"categories":[],"sub_categories":[],"readme":"#Metle\n\n[![Build Status][travis-badge]][travis]\n[![codecov][codecov-badge]][codecov]\n[![Language grade: JavaScript][lgtm-badge]][lgtm]\n![node][node]\n[![npm version][npm-badge]][npm]\n[![devDependencies Status][dev-dependencies-badge]][dev-dependencies]\n[![PRs Welcome][prs-badge]][prs]\n[![GitHub][license-badge]][license]\n\n**Metle** is a memory storage for NodeJS and Deno that supports caching with TTL and maximum number of requests to keep the cache up to date.\n\n## NodeJS setup\n\n`npm install metle`\n\n## Deno import\n\n```ts\nimport { metle } from \"https://deno.land/x/metle/mod.ts\";\n```\n\n## Usage\n\n**Load the default Metle instance**\n```js\n// NodeJS\nimport metle from 'metle'\n// Deno\nimport { metle } from 'https://deno.land/x/metle/mod.ts'\n\nmetle.setItem('foo', 'bar')\n\nconst foo = metle.getItem('foo')\n```\n\n**Create a new Metle instance**\n\n```js\n// NodeJS\nimport { Metle } from 'metle'\n// Deno\nimport { Metle } from 'https://deno.land/x/metle/mod.ts'\n\nconst metleInstance = new Metle({TTL: 2, maxRequest: 50})\nmetle.setItem('foo', 'bar')\n\nconst foo = metle.getItem('foo')\n```\n\n## API\n\n- **getItem**(key: string): any\n- **setItem**(key: string, value: any, timers?:ITimers): boolean\n- **updateItem**(key: string, value: any, timers?:ITimers): boolean\n- **hasItem**(key: string): boolean\n- **resetItemCounter**(key: string, timers?: ITimers): boolean\n- **removeItem**(key: string): boolean\n\n**Default timers**\nTTL = 10 (minutes value)\nmaxRequest = 0\n\n**Metle constructor**\n```js\n  const metle = new Metle(timers?: ITimers)\n```\n\n**Interface ITimers**\n```js\ninterface ITimers {\n  TTL?: number, // default: 10 (min), maximum time to live of an item, 0 for infinite\n  maxRequest?: number, // default: 0, maximum number of gets until the item is removed, 0 for infinite\n}\n```\n\n[travis-badge]: https://travis-ci.com/JWebCoder/metle.svg?branch=master\n[travis]: https://travis-ci.com/JWebCoder/metle\n\n[codecov-badge]: https://codecov.io/gh/JWebCoder/metle/branch/master/graph/badge.svg\n[codecov]: https://codecov.io/gh/JWebCoder/metle\n\n[lgtm-badge]: https://img.shields.io/lgtm/grade/javascript/g/JWebCoder/metle.svg?logo=lgtm\u0026logoWidth=18\n[lgtm]: https://lgtm.com/projects/g/JWebCoder/metle/context:javascript\n\n[node]: https://img.shields.io/node/v/metle.svg\n\n[npm-badge]: https://badge.fury.io/js/metle.svg\n[npm]: https://badge.fury.io/js/metle\n\n[dev-dependencies-badge]: https://david-dm.org/JWebCoder/metle/dev-status.svg\n[dev-dependencies]: https://david-dm.org/JWebCoder/metle?type=dev\n\n[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg\n[prs]: http://makeapullrequest.com\n\n[license-badge]: https://img.shields.io/github/license/JWebCoder/metle.svg\n[license]: https://github.com/JWebCoder/metle/blob/master/LICENSE","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwebcoder%2Fmetle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjwebcoder%2Fmetle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwebcoder%2Fmetle/lists"}