{"id":20820724,"url":"https://github.com/webdad/lib-jsoncache","last_synced_at":"2026-04-27T02:31:08.064Z","repository":{"id":143885821,"uuid":"165610361","full_name":"WebDaD/lib-JSONCache","owner":"WebDaD","description":"A small Lib to Hold a JSON-File in Memory Cache","archived":false,"fork":false,"pushed_at":"2019-01-16T10:18:26.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-26T01:02:54.864Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WebDaD.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-01-14T06:50:43.000Z","updated_at":"2019-01-16T10:18:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"25189e6a-22c8-476d-a3d1-4625d9a168e1","html_url":"https://github.com/WebDaD/lib-JSONCache","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebDaD%2Flib-JSONCache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebDaD%2Flib-JSONCache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebDaD%2Flib-JSONCache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebDaD%2Flib-JSONCache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WebDaD","download_url":"https://codeload.github.com/WebDaD/lib-JSONCache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243166976,"owners_count":20247007,"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-11-17T22:09:57.095Z","updated_at":"2025-12-25T02:51:31.383Z","avatar_url":"https://github.com/WebDaD.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lib-JSONCache\r\n\r\nA small Lib to Hold a JSON-File in Memory Cache\r\n\r\n## Installation\r\n\r\nJust run `npm install lib-jsoncache`\r\n\r\n## Usage\r\n\r\nThe Usage is simple, the config is extensive :-)\r\n\r\n`const JSONCache = require('lib-jsoncache')`  \r\n\r\n`let jc = new JSONCache(config)`  \r\n\r\n### Load File\r\n\r\n`jc.load()`\r\n\r\n### Use Values\r\n\r\nThis is an Array of Objects from the JSON-File\r\n\r\n`jc.data`\r\n\r\nYou may, e.g. `jc.data.push({})`\r\n\r\n### Save File\r\n\r\n`jc.save()`\r\n\r\n### Start / Stop Autosave\r\n\r\nEvery x Seconds (30 seconds or set in Config) the file may autosave using a simple interval.\r\n\r\nTo Start this use:\r\n\r\n`jc.startAutoSave()`\r\n\r\nTo Stop it:\r\n\r\n`jc.stopAutoSave()`\r\n\r\n## Config\r\n\r\nThere are a lot of config parameters to give.  \r\nJust see config.sample.json for a full example of all options.\r\n\r\n### Required\r\n\r\n* file: Name of the JSON-File to Load from / Save to\r\n\r\n### Optional\r\n\r\n* saveInterval: How often to autosave the file (in milliseconds). Default is 30 seconds\r\n* autoload: Set to True to autoload the File on init. otherwise you have to call .load()\r\n* autosave: Set to True to autosave the File in intervals. You may also call .save() whenever you want to save\r\n\r\n## Testing\r\n\r\nTo Test you may install the dev-dependencies.  \r\nThen just run `npm run test`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebdad%2Flib-jsoncache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebdad%2Flib-jsoncache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebdad%2Flib-jsoncache/lists"}