{"id":26720955,"url":"https://github.com/adamjosefus/allo_caching","last_synced_at":"2026-03-15T00:50:36.018Z","repository":{"id":43358385,"uuid":"456887609","full_name":"adamjosefus/allo_caching","owner":"adamjosefus","description":"🦕 Simple cache for Deno.","archived":false,"fork":false,"pushed_at":"2022-11-30T12:48:56.000Z","size":31,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-27T19:43:09.409Z","etag":null,"topics":["cache","caching","deno","server","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/adamjosefus.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}},"created_at":"2022-02-08T10:36:25.000Z","updated_at":"2022-02-14T12:10:22.000Z","dependencies_parsed_at":"2023-01-21T14:44:09.497Z","dependency_job_id":null,"html_url":"https://github.com/adamjosefus/allo_caching","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamjosefus%2Fallo_caching","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamjosefus%2Fallo_caching/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamjosefus%2Fallo_caching/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamjosefus%2Fallo_caching/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adamjosefus","download_url":"https://codeload.github.com/adamjosefus/allo_caching/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248830388,"owners_count":21168272,"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","caching","deno","server","typescript"],"created_at":"2025-03-27T19:35:10.359Z","updated_at":"2026-03-15T00:50:35.962Z","avatar_url":"https://github.com/adamjosefus.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **Allo Caching** for Deno 🦕\n\nSimple caching solution in Typescript.\n\n\n## `Cache\u003cValueType\u003e`\n\n### Load or Generate\n\n```ts\nconst cache = new Cache\u003cstring\u003e();\n\n// Load from cache.\n// If not found, value will be generated and stored in cache.\ncache.load('key_1', () =\u003e {\n    // Some expensive operation\n    return 'Lorem ipsum';\n}); // Return type is string\n\ncache.has('key_1'); // true\ncache.load('key_1'); // 'Lorem ipsum'\n\n\n// Load from cache without generating.\ncache.load('key_2'); // Return type is string | undefined\n\n// Save to cache.\ncache.save('key_2', 'Lorem ipsum');\n\n// Check if cache exists.\ncache.has('key_2'); // true\ncache.load('key_2'); // 'Lorem ipsum'\n```\n\n\n###  Invalidation\n#### Expiration\n```ts\nconst cache = new Cache\u003cnumber\u003e();\n\ncache.save('key', 42, {\n    expire: 1000 // Expire after 1 second.\n});\n\n\n// Works with load generator too.\ncache.load('key', () =\u003e 42, { expire: 1000 });\n```\n\n```ts\nconst cache = new Cache\u003cnumber\u003e();\n\ncache.save('key', 42, {\n    expire: 1000,\n    sliding: true // Update expiration after each load\n});\n```\n\n#### Files\n```ts\nconst cache = new Cache\u003cstring\u003e();\n\ncache.save('key', \"My text data\", {\n    files: [\n        'file_1.txt',\n        'file_2.txt'\n    ] // Expired when some file is modified or deleted.\n});\n```\n\n#### Callbacks\n```ts\nconst cache = new Cache\u003cstring\u003e();\n\nfunction isValid(): boolean {\n    //...\n    return true;\n}\n\ncache.save('key', \"My text data\", {\n    callbacks: [\n        isValid,\n        () =\u003e false,\n    ] // Expired when some callback returns false.\n});\n```\n\n\n## Documentation 📖\n\nDescription of all classes and methods with **examples** will found in the [documentation](https://doc.deno.land/https://deno.land/x/allo_caching/mod.ts).\n\n---\n\nCheck out other [ours packages 📦](https://deno.land/x?query=allo_)!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamjosefus%2Fallo_caching","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadamjosefus%2Fallo_caching","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamjosefus%2Fallo_caching/lists"}