{"id":25121872,"url":"https://github.com/aidenwallis/hotcache","last_synced_at":"2025-06-24T10:36:59.551Z","repository":{"id":57520417,"uuid":"236983876","full_name":"aidenwallis/hotcache","owner":"aidenwallis","description":"A small hash-map cache in Golang designed for small TTL.","archived":false,"fork":false,"pushed_at":"2020-01-29T16:27:08.000Z","size":127,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T15:43:41.857Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/aidenwallis.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":"2020-01-29T13:05:40.000Z","updated_at":"2024-08-31T15:45:51.000Z","dependencies_parsed_at":"2022-09-26T18:00:52.604Z","dependency_job_id":null,"html_url":"https://github.com/aidenwallis/hotcache","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aidenwallis/hotcache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidenwallis%2Fhotcache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidenwallis%2Fhotcache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidenwallis%2Fhotcache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidenwallis%2Fhotcache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aidenwallis","download_url":"https://codeload.github.com/aidenwallis/hotcache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidenwallis%2Fhotcache/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261652929,"owners_count":23190367,"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":"2025-02-08T06:37:46.508Z","updated_at":"2025-06-24T10:36:59.527Z","avatar_url":"https://github.com/aidenwallis.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hotcache\n\n[![GoDoc](https://godoc.org/github.com/aidenwallis/hotcache?status.svg)](https://godoc.org/github.com/aidenwallis/hotcache)\n[![Build Status](https://travis-ci.org/aidenwallis/hotcache.svg?branch=master)](https://travis-ci.org/aidenwallis/hotcache)\n[![Coverage Status](https://coveralls.io/repos/github/aidenwallis/hotcache/badge.svg?branch=master)](https://coveralls.io/github/aidenwallis/hotcache?branch=master)\n\nA small hash-map cache in Golang designed for small TTL. It's a simple hashmap implementation that allows you to effectively handle TTL on temporary keys. TTL works on last set wins, meaning if you set a longer TTL on a key, it will expire when the new TTL is set.\n\nIt invalidates keys by checking 1000 random keys in store every 100ms, as well as does an expiry check per lookup/set.\n\nHotcache is completely thread-safe due to its use of RWMutexes, therefore you don't need to be concerned with doing that yourself. I originally wrote this package months ago and chose to make it public to just make my life easier for [Fossabot](https://fossabot.com).\n\n## Usage\n\nThis package is incredibly easy to use, like so\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/aidenwallis/hotcache\"\n)\n\nfunc main() {\n\tcache := hotcache.New()\n\n\tcache.Set(\"key\", \"value\", time.Second*2)\n\n\tvalue, ok := cache.Get(\"key\")\n\tif ok {\n\t\t// This key exists in the hashmap.\n\t\tfmt.Println(\"Key value: \" + value.(string))\n\t}\n\n    // Sleep until cache expires.\n    time.Sleep(time.Second * 2)\n    \n    exists := cache.Has(\"key\")\n    if !exists {\n        fmt.Println(\"Key has now expired!\")\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faidenwallis%2Fhotcache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faidenwallis%2Fhotcache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faidenwallis%2Fhotcache/lists"}