{"id":20519818,"url":"https://github.com/jabranr/js-memcache","last_synced_at":"2026-04-20T02:03:54.424Z","repository":{"id":57283398,"uuid":"77353260","full_name":"jabranr/js-memcache","owner":"jabranr","description":"Store data in memory for better performance by saving on network requests.","archived":false,"fork":false,"pushed_at":"2023-10-28T23:42:57.000Z","size":45,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-16T01:06:45.172Z","etag":null,"topics":["cache","in-memory-storage","javascript","nodejs","requirejs"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/js-memcache","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/jabranr.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":"2016-12-26T02:45:35.000Z","updated_at":"2023-10-28T23:43:47.000Z","dependencies_parsed_at":"2022-08-31T00:00:17.998Z","dependency_job_id":null,"html_url":"https://github.com/jabranr/js-memcache","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabranr%2Fjs-memcache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabranr%2Fjs-memcache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabranr%2Fjs-memcache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jabranr%2Fjs-memcache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jabranr","download_url":"https://codeload.github.com/jabranr/js-memcache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242123332,"owners_count":20075348,"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":["cache","in-memory-storage","javascript","nodejs","requirejs"],"created_at":"2024-11-15T22:16:29.807Z","updated_at":"2026-04-20T02:03:49.360Z","avatar_url":"https://github.com/jabranr.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSMemcache [![Build Status](https://travis-ci.org/jabranr/js-memcache.svg?branch=master)](https://travis-ci.org/jabranr/js-memcache) [![npm version](https://img.shields.io/npm/v/js-memcache.svg)](https://www.npmjs.com/package/js-memcache)\n\nStore data in memory for better performance by saving on network requests. (~600 bytes \u0026ndash; minified and gzipped)\n\n# Installation\n\n#### Using [npm](https://npmjs.org):\n\n```shell\n$ npm install js-memcache --save-dev\n```\n\n#### Using [bower](https://bower.io):\n\n```shell\n$ bower install js-memcache --save-dev\n```\n\n#### In browser:\n`JSMemcache` is available via namespace `JSMemcache` in browsers' global scope i.e.\n\n```html\n\u003cscript src=\"path/to/JSMemcache.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  const jsMemcache = new JSMemcache(); // available via window.JSMemcache\n  ...\n\u003c/script\u003e\n```\n\n#### In node / Using CommonJS:\n`JSMemcache` can be setup in node as following i.e.\n\n```javascript\nconst JSMemcache = require('JSMemcache');\nconst jsMemcache = new JSMemcache();\n...\n```\n\n#### Using AMD (RequireJS):\n`JSMemcache` can be setup as following using RequireJS i.e.\n\n```javascript\nrequire(['path/to/JSMemcache'], function(JSMemcache) {\n  const jsMemcache = new JSMemcache();\n  ...\n});\n```\n\n# API\n\nJSMemcache exposes following API:\n\n#### `.setLimit(limit {int})`\nSet cache maximum limit. Default is set to 100 entries.\n\n#### `.setSeparator(separator {string})`\nSet a key separator for each entry in cache. Default is `+`.\n\n#### `.getLimit()`\nGet cache's current limit.\n\n#### `.getSeparator()`\nGet cache's current separator.\n\n#### `.getSize()`\nGet cache's current size.\n\n#### `.add(key {string|array}, value {mixed})`\nAdd a new entry into cache as key value pair. Throws a `TypeError` if key is neither a `string` nor an `array`.\n\n#### `.get(key {string|array})`\nGet an entry by key from cache.\n\n#### `.update(key {string|array}, value {mixed})`\nUpdate an entry by key in cache. Throws a `ReferenceError` if key does not exist in cache.\n\n#### `.remove(key {string|array})`\nRemove an entry by key from cache. Throws a `ReferenceError` if key does not exist in cache.\n\n#### `.all()`\nGet list of all entries in cache.\n\n#### `.keys()`\nGet list of keys for all entries in cache.\n\n#### `.clear()`\nClear all data in cache and remove all entries.\n\n#### `.set(key {string|array}, value {mixed})`\nAn alias for `.add()`\n\n#### `.replace(key {string|array}, value {mixed})`\nAn alias for `.update()`\n\n# Issues / Contributing\n\nIf you find an issue or wish to suggest any improvements then use the [issue tracker](https://github.com/jabranr/js-memcache/issues/new) to file an issue. Please provide as much possible details in there. Even better that you can submit a pull request for your issue if you already have a solution in mind.\n\nContribution is most welcome. To cotribute, fork the repository and branch out from `master` for your changes. Make sure you update/add tests. This repository uses the fantastic and super easy-to-use testing framework [AVA](https://github.com/avajs/ava). Once ready [open a pull request](https://github.com/jabranr/js-memcache/compare).\n\n![https://github.com/jabranr/js-memcache](https://cloud.githubusercontent.com/assets/2131246/21534079/c24ba51a-cd59-11e6-8620-40904de19343.png)\n\n# License\nMIT License\n\u0026copy; 2016 \u0026ndash; Jabran Rafique","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjabranr%2Fjs-memcache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjabranr%2Fjs-memcache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjabranr%2Fjs-memcache/lists"}