{"id":18119634,"url":"https://github.com/mostlygeek/node-simple-cache","last_synced_at":"2025-07-02T17:06:19.503Z","repository":{"id":57171467,"uuid":"2640760","full_name":"mostlygeek/Node-Simple-Cache","owner":"mostlygeek","description":"Simple disk caching module for node.js","archived":false,"fork":false,"pushed_at":"2012-08-24T17:19:12.000Z","size":114,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-24T01:17:37.319Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/mostlygeek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-10-25T02:37:30.000Z","updated_at":"2023-08-23T10:40:02.000Z","dependencies_parsed_at":"2022-08-27T12:02:31.328Z","dependency_job_id":null,"html_url":"https://github.com/mostlygeek/Node-Simple-Cache","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mostlygeek/Node-Simple-Cache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mostlygeek%2FNode-Simple-Cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mostlygeek%2FNode-Simple-Cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mostlygeek%2FNode-Simple-Cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mostlygeek%2FNode-Simple-Cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mostlygeek","download_url":"https://codeload.github.com/mostlygeek/Node-Simple-Cache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mostlygeek%2FNode-Simple-Cache/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263182174,"owners_count":23426632,"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-01T05:16:20.559Z","updated_at":"2025-07-02T17:06:19.470Z","avatar_url":"https://github.com/mostlygeek.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![build status](https://secure.travis-ci.org/mostlygeek/Node-Simple-Cache.png)](http://travis-ci.org/mostlygeek/Node-Simple-Cache)\n\n# About\n\nA *really* simple cache to disk library. It will either return data from the disk cache file or fetch it from the source. \n\n# Install\n\n    \u003e npm install Simple-Cache\n\n# Usage Examples\n\n# Basic Example\n    /**\n     * Like just run this. It should be self explanitory \n     * how it works. \n     */\n    var cache = require('Simple-Cache').SimpleCache(\"/tmp\", console.log);\n    \n    /**\n     *  cache.get returns a promise, cause tons of callback chains\n     *  suck. \n     *  \n     *  Usage: get(string key, cacheMissFn) { .... }\n     */ \n    var promise = cache.get('my testing data', function(callback) {\n        // some async operation... \n        callback(results);    \n    });\n\n## Multiple Callback Handlers on the Promise\n\n    promise.fulfilled(function(results) {\n       console.log(\"Callback 1: \" + results);\n    });\n    \n    promise.fulfilled(function(results) {\n       console.log(\"Callback 2: \" + results);\n    });\n\n## Fluent Interfaces\n\n    promise.fulfilled(function(results) {\n        console.log(\"Fluent interface 1\");\n    }).fulfilled(function(results) {\n        console.log(\"Fluent interface 2\");\n    }).fulfilled(function(results) {\n        console.log(\"Fluent interface 3. Ok we get it\");\n    });\n\n# How To Use It In Real Life\n\n    /**\n     * \n     * A Practical example. Cachine Web results.\n     * \n     */\n    cache.get('omgz! the same file!', function(callback) {\n        \n        console.log(\"Fetching from https://raw.github.com/...\");\n        \n        require('https').get({\n            host : 'raw.github.com', \n            path : '/mostlygeek/Node-Simple-Cache/master/examples.js'\n        }, function(res) {           \n           var data = '';\n    \n           res.on('data', function(chunk) {\n              data += chunk; \n           }).on('end', function() {\n               callback(data);\n           });\n        });    \n    }).fulfilled(function(data) {\n        console.log(\"Blam!, Got back \" + data.length + \" bytes\");\n    });\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmostlygeek%2Fnode-simple-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmostlygeek%2Fnode-simple-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmostlygeek%2Fnode-simple-cache/lists"}