{"id":23123508,"url":"https://github.com/knbr13/incache","last_synced_at":"2025-08-17T03:31:32.314Z","repository":{"id":204149089,"uuid":"656933716","full_name":"knbr13/incache","owner":"knbr13","description":"Simple, fast, concurrent in-memory database.","archived":false,"fork":false,"pushed_at":"2024-06-09T20:29:41.000Z","size":922,"stargazers_count":14,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-12T05:54:18.520Z","etag":null,"topics":["blazingly-fast","cache","db","go","golang","inmemory-db","thread-safe"],"latest_commit_sha":null,"homepage":"","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/knbr13.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-22T00:35:27.000Z","updated_at":"2025-04-12T20:17:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"94179238-276d-4201-b510-4df983422b2e","html_url":"https://github.com/knbr13/incache","commit_stats":null,"previous_names":["abdullah-alaadine/express-rest-api-template","knbr13/express-rest-api-template","knbr13/lets-go","knbr13/in-memdb"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/knbr13/incache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knbr13%2Fincache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knbr13%2Fincache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knbr13%2Fincache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knbr13%2Fincache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/knbr13","download_url":"https://codeload.github.com/knbr13/incache/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knbr13%2Fincache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270802898,"owners_count":24648664,"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","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"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":["blazingly-fast","cache","db","go","golang","inmemory-db","thread-safe"],"created_at":"2024-12-17T07:35:02.632Z","updated_at":"2025-08-17T03:31:32.042Z","avatar_url":"https://github.com/knbr13.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## incache\n\nThe `incache` package provides a simple cache implementation in Go. It can be used as a package in other Go projects to store key-value pairs in memory. The package is safe to use concurrently with multiple goroutines.\n\n### Installation\n\nTo use this package in your Go project, you can install it using `go get`:\n\n```bash\ngo get github.com/knbr13/incache\n```\n\n### Example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/knbr13/incache\"\n)\n\nfunc main() {\n\t// create a new LRU Cache\n\tc := incache.NewLRU[string, int](10)\n\n\tfmt.Println(\"keys:\", c.Keys())\n\n\t// set some key-value pairs\n\tc.Set(\"one\", 1)\n\tc.Set(\"two\", 2)\n\tc.Set(\"three\", 3)\n\tc.Set(\"four\", 4)\n\tc.Set(\"five\", 5)\n\n\tc.SetWithTimeout(\"six\", 6, time.Millisecond)\n\n\t// Get values by key\n\tv, ok := c.Get(\"one\")\n\tif ok {\n\t\tfmt.Println(\"Value for key1:\", v)\n\t}\n\n\tv, ok = c.Get(\"two\")\n\tif ok {\n\t\tfmt.Println(\"Value for key1:\", v)\n\t}\n\n\tc.Delete(\"one\")\n\n\t// create new cache, move data from 'c' to 'c2'\n\tc2 := incache.NewLRU[string, int](10)\n\tc.TransferTo(c2)\n\n\t// create new cache, copy data from 'c2' to 'c3'\n\tc3 := incache.NewLRU[string, int](10)\n\tc2.CopyTo(c3)\n}\n```\n\n### Contributing\n\nContributions are welcome! \nIf you find any bugs or have suggestions for improvements, please open an issue or submit a pull request on GitHub.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknbr13%2Fincache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknbr13%2Fincache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknbr13%2Fincache/lists"}