{"id":40811373,"url":"https://github.com/hunterhug/gocache","last_synced_at":"2026-01-21T21:18:00.451Z","repository":{"id":57626047,"uuid":"401283572","full_name":"hunterhug/gocache","owner":"hunterhug","description":"💐Memory Cache Implement By Golang","archived":false,"fork":false,"pushed_at":"2021-08-31T09:29:25.000Z","size":73,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T14:21:52.826Z","etag":null,"topics":["cache","cache-storage","gocache","kvstore","memorycache","minheap","rbtree","treemap"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hunterhug.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2021-08-30T09:15:31.000Z","updated_at":"2024-04-24T00:51:25.000Z","dependencies_parsed_at":"2022-08-30T12:50:49.862Z","dependency_job_id":null,"html_url":"https://github.com/hunterhug/gocache","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/hunterhug/gocache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunterhug%2Fgocache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunterhug%2Fgocache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunterhug%2Fgocache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunterhug%2Fgocache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hunterhug","download_url":"https://codeload.github.com/hunterhug/gocache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunterhug%2Fgocache/sbom","scorecard":{"id":473582,"data":{"date":"2025-08-11","repo":{"name":"github.com/hunterhug/gocache","commit":"9ddc7cf2984a6897ed1e52bcd2a58d5d87320c6d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/4 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T14:38:53.874Z","repository_id":57626047,"created_at":"2025-08-19T14:38:53.874Z","updated_at":"2025-08-19T14:38:53.874Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28643317,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T18:04:35.752Z","status":"ssl_error","status_checked_at":"2026-01-21T18:03:55.054Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cache","cache-storage","gocache","kvstore","memorycache","minheap","rbtree","treemap"],"created_at":"2026-01-21T21:17:59.547Z","updated_at":"2026-01-21T21:18:00.445Z","avatar_url":"https://github.com/hunterhug.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Memory Cache auto clean expired data implement by Golang\n\n[![GitHub forks](https://img.shields.io/github/forks/hunterhug/gocache.svg?style=social\u0026label=Forks)](https://github.com/hunterhug/gocache/network)\n[![GitHub stars](https://img.shields.io/github/stars/hunterhug/gocache.svg?style=social\u0026label=Stars)](https://github.com/hunterhug/gocache/stargazers)\n[![GitHub last commit](https://img.shields.io/github/last-commit/hunterhug/gocache.svg)](https://github.com/hunterhug/gocache)\n[![GitHub issues](https://img.shields.io/github/issues/hunterhug/gocache.svg)](https://github.com/hunterhug/gocache/issues)\n\n[中文说明](/README_ZH.md)\n\nI use Red-Black Tree Map and Minimum Heap keep the data in memory (the root node of Minimum Heap has the oldest value, so we can fast clean the expired values).\n\nCache in memory implement very efficient, No pre allocated space required.\n\n## Usage\n\nSimple get it by:\n\n```\ngo get -v github.com/hunterhug/gocache\n```\n\n## Demo\n\nFollow the interface method：\n\n```go\ntype Cache interface {\n    Set(key string, value []byte, expireTime time.Duration)\n    SetInterface(key string, value interface{}, expireTime time.Duration)\n    SetByExpireUnixNanosecondDateTime(key string, value []byte, expireUnixNanosecondDateTime int64)\n    SetInterfaceByExpireUnixNanosecondDateTime(key string, value interface{}, expireUnixNanosecondDateTime int64)\n    Delete(key string)\n    Get(key string) (value []byte, expireUnixNanosecondDateTime int64, exist bool)\n    GetInterface(key string) (value interface{}, expireUnixNanosecondDateTime int64, exist bool)\n    GetOldestKey() (key string, expireUnixNanosecondDateTime int64, exist bool)\n    Size() int\n    Index(index int) (value []byte, expireUnixNanosecondDateTime int64, exist bool)\n    IndexInterface(index int) (value interface{}, expireUnixNanosecondDateTime int64, exist bool)\n    KeyList() []string\n    ShutDown()\n}\n```\n\nYou can choose to set cache with expireTime `time.Duration = 1 minute` by call `Set(key string, value []byte, expireTime time.Duration)` or other method.\n\nExample:\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/hunterhug/gocache\"\n\t\"time\"\n)\n\nfunc main() {\n\tcache := gocache.New()\n\tdefer cache.ShutDown()\n\n\tcache.Set(\"a\", []byte(\"a hi\"), 2*time.Second)\n\tcache.Set(\"b\", []byte(\"b hi\"), 2*time.Second)\n\tcache.SetInterface(\"c\", []byte(\"c hi\"), 2*time.Second)\n\n\tfmt.Println(cache.Size())\n\tfmt.Println(cache.GetOldestKey())\n\tfmt.Println(cache.KeyList())\n\tfmt.Println(cache.Get(\"a\"))\n\tfmt.Println(cache.GetInterface(\"c\"))\n\n\ttime.Sleep(2 * time.Second)\n\tfmt.Println(cache.Get(\"a\"))\n}\n```\n\n# License\n\n```\nCopyright [2019-2021] [github.com/hunterhug]\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhunterhug%2Fgocache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhunterhug%2Fgocache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhunterhug%2Fgocache/lists"}