{"id":18553714,"url":"https://github.com/websemantics/larder","last_synced_at":"2025-05-15T11:34:04.637Z","repository":{"id":58238616,"uuid":"65054001","full_name":"websemantics/larder","owner":"websemantics","description":"Straightforward, in browser cache using local storage.","archived":false,"fork":false,"pushed_at":"2017-02-17T19:58:04.000Z","size":10,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-01T01:39:32.569Z","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/websemantics.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","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-08-05T22:56:48.000Z","updated_at":"2021-01-13T19:50:39.000Z","dependencies_parsed_at":"2022-08-31T00:30:44.490Z","dependency_job_id":null,"html_url":"https://github.com/websemantics/larder","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/websemantics%2Flarder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/websemantics%2Flarder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/websemantics%2Flarder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/websemantics%2Flarder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/websemantics","download_url":"https://codeload.github.com/websemantics/larder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254331014,"owners_count":22053091,"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-06T21:18:05.276Z","updated_at":"2025-05-15T11:34:04.613Z","avatar_url":"https://github.com/websemantics.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"```        \n          ______________________________________       \n         /\\                                     \\\n        /  \\                                     \\\n       /    \\                                     \\\n      /      \\_____________________________________\\__________________\n     /       /                 /       \\░░░░░░░░░░░/                 /\n    /       /                 /         \\░░░░░░░░░/                 /\n   /       /                 /           \\░░░░░░░/                 /\n   \\      /                 /             \\░░░░░/                 /\n    \\    /                 /               \\░░░/                 /\n     \\  /                 /                 \\░/                 /\n      \\/_________________/___________________\\_________________/\n\n          __        ______    ______    _____    ______    ______    \n         /\\ \\      /\\  __ \\  /\\  == \\  /\\  __-. /\\  ___\\  /\\  == \\   \n         \\ \\ \\____ \\ \\  __ \\ \\ \\  __\u003c  \\ \\ \\/\\ \\ \\ \\  __\\  \\ \\  __\u003c   \n          \\ \\_____\\ \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\ \\____-  \\ \\_____\\ \\ \\_\\ \\_\\\n           \\/_____/  \\/_/\\/_/  \\/_/ /_/  \\/____/   \\/_____/  \\/_/ /_/\n\n             Straightforward,  in  browser  cache  using  local  storage                                                               \n\n```\n\n## Install\n\nBower\n\n```bash\nBower install larder\n```\n\nNPM\n\n```bash\nnpm i larder\n```\n\n## Getting Started\n\nLarder supports a simple usage of the Bowser's local storage with expirations (60 minutes by default). The library uses a configurable namespace (id) to protect and avoid clashes with items stored by other applications.\n\nTo change these values, use the `defaults` method,\n\n```javascript\nLarder.defaults({\n  id:'namespace',\n  expires: '120' /* two hours expiration per item */\n})\n```\n\n## Usage\n\nThe library provides all you expect from such a utility including,\n\n**save**, this method expects `key`, `value`, and optional `expires` parameter (overrides the global settings).\n\n```javascript\nLarder.save('don', {\n  name: 'Don Juan',\n  height: '165cm',\n  weight: '59kg',\n  age: 66\n})\n```\n\n**fetch**, retrieves the `value` or a stored item - providing a `key`, or it returns `null` if it does not exist or has expired. All expired items are removed from the local storage.\n\n```javascript\nLarder.fetch('don')\n```\n\n`Console.log` output\n\n```\nObject  {name: 'Don Juan', height: '165cm',weight: '59kg',  age: 66}\n```\n\n**remove**, savely removes an item from the storage for the given `key`.\n\n```javascript\nLarder.remove('don')\n```\n\noutput\n\n```\nWell, he wasn't here to start with.\n```\n\n**clear**, this method expects will clear all items with the given `namespace`.\n\n```javascript\nLarder.clear()\n```\n\n## Examples\n\nA Github reader library, [Gitters](https://github.com/websemantics/gitters) uses Larder to implement cache.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebsemantics%2Flarder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebsemantics%2Flarder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebsemantics%2Flarder/lists"}