{"id":25739575,"url":"https://github.com/shellkah/goutte","last_synced_at":"2026-02-12T10:31:27.065Z","repository":{"id":277573407,"uuid":"932860071","full_name":"shellkah/goutte","owner":"shellkah","description":"Thread-safe and type-safe cache implemented in Go. It provides fast point queries (Hashmap), precise TTLs (Heap-based) and auto eviction when the cache exceeds its capacity (LRU).","archived":false,"fork":false,"pushed_at":"2025-02-16T17:10:09.000Z","size":20,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-25T12:51:19.782Z","etag":null,"topics":["cache","go","key-value","lru-cache","thread-safe","ttl-cache","type-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/shellkah.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,"zenodo":null}},"created_at":"2025-02-14T16:48:08.000Z","updated_at":"2025-02-16T17:10:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"8074e7a8-3cf7-4140-9d5b-ac3491ebd874","html_url":"https://github.com/shellkah/goutte","commit_stats":null,"previous_names":["shellkah/goutte"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/shellkah/goutte","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellkah%2Fgoutte","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellkah%2Fgoutte/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellkah%2Fgoutte/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellkah%2Fgoutte/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shellkah","download_url":"https://codeload.github.com/shellkah/goutte/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellkah%2Fgoutte/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29363152,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T08:51:36.827Z","status":"ssl_error","status_checked_at":"2026-02-12T08:51:26.849Z","response_time":55,"last_error":"SSL_read: 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","go","key-value","lru-cache","thread-safe","ttl-cache","type-safe"],"created_at":"2025-02-26T08:29:08.291Z","updated_at":"2026-02-12T10:31:27.032Z","avatar_url":"https://github.com/shellkah.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Goutte Cache\n\nThread-safe and type-safe LRU (Least Recently Used) cache implemented in Go. This cache provides fast point queries via a hash map, use heap-based expiration to handle TTLs and maintains access order with a doubly linked list, automatically evicting the least recently used item when the cache exceeds its capacity.\n\n## Features\n\n- **Generics**: Specify key and value types at creation time for compile-time type safety.\n- **Thread-Safe**: Safe for concurrent access using a mutex.\n- **LRU Eviction Policy**: Automatically removes the least recently used entry when adding new items beyond the specified capacity.\n- **Optional TTL**: Automatically removes expired items with precision with a min-heap (priority queue) to keep track of expiration times.\n- **Fast Lookups**: Uses a hash map for O(1) average-time complexity for queries.\n- **Simple API**: Provides basic operations such as `Get`, `Set`, and `Delete`.\n\n## Installation\n\nTo include the cache in your project, use Go modules. In your project directory, run:\n\n```bash\ngo get github.com/shellkah/goutte\n```\n\n## Usage\n\nHere's an example of how to use the cache:\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/shellkah/goutte\"\n)\n\nfunc main() {\n\t// Create a cache where keys are strings and values are ints.\n\tcache := goutte.NewCache[string, int](3)\n\tdefer cache.Close()\n\n\t// Insert key-value pairs.\n\tcache.Set(\"a\", 1)\n\tcache.Set(\"b\", 2)\n\tcache.Set(\"c\", 3)\n\n\t// Retrieve a value.\n\tif val, found := cache.Get(\"a\"); found {\n\t\tfmt.Println(\"Value for 'a':\", val)\n\t} else {\n\t\tlog.Println(\"Key 'a' not found\")\n\t}\n\n\t// Adding a new key causes eviction of the least recently used item.\n\tcache.Set(\"d\", 4)\n\n\t// 'b' should be evicted if it was the least recently used.\n\tif _, found := cache.Get(\"b\"); !found {\n\t\tfmt.Println(\"Key 'b' was evicted.\")\n\t}\n}\n```\n\n## Contributing\n\nContributions are welcome! Please open issues or submit pull requests if you have any ideas, bug fixes, or enhancements.\n\n## License\n\nThis project is licensed under the MIT License. See the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshellkah%2Fgoutte","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshellkah%2Fgoutte","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshellkah%2Fgoutte/lists"}