{"id":25687187,"url":"https://github.com/holyshared/class.cache","last_synced_at":"2026-06-13T02:02:15.606Z","repository":{"id":1972273,"uuid":"2903582","full_name":"holyshared/Class.Cache","owner":"holyshared","description":"The mixin library which includes a cache function in a class","archived":false,"fork":false,"pushed_at":"2011-12-04T03:27:59.000Z","size":128,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-07T01:58:17.476Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/holyshared.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":"2011-12-03T06:08:48.000Z","updated_at":"2013-10-06T04:21:02.000Z","dependencies_parsed_at":"2022-09-06T21:04:05.398Z","dependency_job_id":null,"html_url":"https://github.com/holyshared/Class.Cache","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/holyshared/Class.Cache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holyshared%2FClass.Cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holyshared%2FClass.Cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holyshared%2FClass.Cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holyshared%2FClass.Cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/holyshared","download_url":"https://codeload.github.com/holyshared/Class.Cache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holyshared%2FClass.Cache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34269364,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-13T02:00:06.617Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-02-24T20:08:20.633Z","updated_at":"2026-06-13T02:02:15.586Z","avatar_url":"https://github.com/holyshared.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nClass.Cache\n========================================\n\nThe mixin library which includes a cache function in a class\n\n\nHow to use\n----------------------------------------\n\nDirections for use only specify **Caches**, when defining a class.  \nThe value specified as **Caches** is a storage name to be used. \n\n### Cache storage\n\n* local - **localStorage** is used.\n* session - **sessionStorage** is used.\n* hash - storage which uses hash is used.\n\nThe code at the time of actually using it is as follows. \n\n\tvar MyClass = new Class({\n\n\t\tImplements: [Events],\n\n\t    Caches: 'hash',\n\n\t    fetch: function(criteria){\n\n\t        var model = this,\n\t\t\t\tcache = model.cache.get(criteria);\n\n\t\t\t//The check of cache \n\t        if (cache){\n\t\t\t\tif (cache.isLimit() !== true){\n\t\t\t\t\t//The cached contents are returned.\n\t\t\t\t\tmodel.fireEvent('success', [cache.getContent()]);\n\t\t        \treturn;\n\t\t\t\t}\n\t\t\t\tcache.destroy();\n\t        }\n\n\t\t\tvar request = new Request.JSON({\n\t\t\t\tmethod: 'get',\n\t\t\t\turl: '/path/to/query?' + criteria,\n\t\t\t\tonSuccess: function(responseJSON, responseText){\n\t\t\t\t\t//Cache of a response result \n\t\t\t\t\tmodel.cache.set(criteria, responseJSON, 1 * 60 * 60 * 1000);\n\t\t\t\t\tmodel.fireEvent('success', [responseJSON]);\n\t\t\t\t}\n\t\t\t});\n\t\t\trequest.send();\n\n\t    }\n\n\t});\n\n\nMoreover, the priority of the storage to be used can be specified.  \nThe appointed method is only specified as Caches in arrangement.\n\nIn the following example, it is specified that it uses in order of localStorage, sessionStorage, and hashStorage.\n\n\tCaches: ['local', 'session', 'hash']\n\nor\n\n\tCaches: ['local', 'session']\n\nAs for the browser which cannot use localStorage and sessionStorage, hashStorage is used compulsorily.\n\n\nScreenshot\n-----------------------------------------\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholyshared%2Fclass.cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fholyshared%2Fclass.cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholyshared%2Fclass.cache/lists"}