{"id":44019297,"url":"https://github.com/raghavgh/gofast","last_synced_at":"2026-02-07T16:07:11.849Z","repository":{"id":190431203,"uuid":"682609091","full_name":"raghavgh/gofast","owner":"raghavgh","description":"One-stop Shop for Optimal Go Caching: All Cache Algorithms Under One Roof.","archived":false,"fork":false,"pushed_at":"2024-12-05T05:47:45.000Z","size":44,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-05T06:28:57.437Z","etag":null,"topics":["algorithms","cache","golang","inmemory-cache"],"latest_commit_sha":null,"homepage":"","language":"Go","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/raghavgh.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-24T14:35:54.000Z","updated_at":"2024-12-05T05:59:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"ad17b51d-841d-44ee-ab54-26367327975c","html_url":"https://github.com/raghavgh/gofast","commit_stats":null,"previous_names":["raghavgh/gofast"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/raghavgh/gofast","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raghavgh%2Fgofast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raghavgh%2Fgofast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raghavgh%2Fgofast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raghavgh%2Fgofast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raghavgh","download_url":"https://codeload.github.com/raghavgh/gofast/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raghavgh%2Fgofast/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29199519,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T14:35:27.868Z","status":"ssl_error","status_checked_at":"2026-02-07T14:25:51.081Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["algorithms","cache","golang","inmemory-cache"],"created_at":"2026-02-07T16:07:11.147Z","updated_at":"2026-02-07T16:07:11.838Z","avatar_url":"https://github.com/raghavgh.png","language":"Go","readme":"# gofast\n\ngofast is a Go module that provides easy-to-use in-memory cache algorithms like LRU (Least Recently Used). It allows you to import and use these algorithms simply and directly in your Go projects.\n\n## Key Features:\n1. \u003cB\u003eHigh Speed\u003c/B\u003e : Optimized for low-latency operations, making it one of the fastest in-memory caching solutions available.\n2. \u003cB\u003eThread-Safe\u003c/B\u003e : Designed with concurrency in mind, allowing multiple goroutines to safely access and modify the cache.\n3. \u003cB\u003eSimple API\u003c/B\u003e : Offers a straightforward and easy-to-use API for basic caching operations like Get, Set, and Remove.\n4. \u003cB\u003eCustomizable Eviction Policy\u003c/B\u003e: Supports options like LRU (Least Recently Used) for memory management when cache size reaches its limit.\n5. \u003cB\u003eLightweight\u003c/B\u003e : Minimal external dependencies, ensuring a lean and performant implementation.\n6. \u003cB\u003eCustom Optimized Data Structures\u003c/B\u003e : Leverages its own highly efficient in-built data structures, specifically tailored for time efficiency and reduced overhead, giving it a competitive edge in speed and performance.\n\n## Installation\n\nInstall gofast by simply using the `go get` command:\n\n```bash\n$ go get github.com/raghavgh/gofast\n```\n\n## Usage\n### Importing the module\nFirst, import gofast like this:\n\n```go\nimport \"github.com/raghavgh/gofast\"\n```\nHere is an example of how you can use the module:\n```go\ntype CacheRepo struct {\n    MetaCache gofast.Cache\n}\n\nfunc NewCacheRepo() *CacheRepo {\n    return \u0026CacheRepo{\n        // gofast.LRU is the algorithm type for LRU.\n\t// 1000 is limit of your cache.\n        MetaCache: gofast.NewCache(1000, gofast.LRU),\n    }\n}\n```\n### Available Functions\n```go\n// Get returns the value (if any) and a boolean representing whether the value was found or not\nGet(key string) (any, bool)\n// Put adds a value to the cache\nPut(key string, val any)\n// Remove removes a value from the cache\nRemove(key string)\n// Len returns the number of elements of the cache\nLen() int\n// Clear clears the cache\nClear()\n// Contains returns true if the cache contains the given key\nContains(key string) bool\n```\n**All above funtions are thread safe\n\n### Available Cache Algorithms\nCurrently, the following cache algorithms are available:\n\n1. LRU (Least Recently Used)\n\n2. LFU (Least Frequently Used)\n\n3. LIFO (Last In, First Out)\n\n4. FIFO (First In, First Out)\n\n5. MRU (Most Recently Used) \n\nMore algorithms will be available in future versions.\n\nSupported algorithms can be specified with the following constants:\n\n```go\ngofast.LRU   // Least Recently Used algorithm\ngofast.LFU   // Least Frequently Used algorithm\ngofast.FIFO  // First In, First Out algorithm\ngofast.MRU   // Most Recently Used algorithm\ngofast.RR    // Random Replacement algorithm\ngofast.SLRU  // Segmented Least Recently Used algorithm\ngofast.LIFO  // Last In, First Out algorithm\n```\n## 🤝 Contributions Welcome!\nWe’re excited to have you contribute to the gofast library! Whether you’re fixing bugs 🐛, adding new features ✨, improving documentation 📚, or enhancing test coverage 🧪—we’d love your help!\n\n#### How to Get Started:\n\n1. 🍴 Fork the repository and create your feature branch (git checkout -b feature/AmazingFeature).\n2. 🛠️ Make your changes and commit them (git commit -m 'Add some AmazingFeature').\n3. ⏫ Push to the branch (git push origin feature/AmazingFeature).\n4. 🔍 Open a pull request, and we’ll review it as soon as possible!\n\n#### Looking for Ideas?\n\nCheck out our [issues page](https://github.com/raghavgh/gofast/issues) for a list of open tasks or feel free to suggest your own improvements! We’re especially interested in:\n\n- 🧩 Implementing new cache algorithms (e.g., MRU). \n- 🔍 Adding more unit tests for better coverage. \n- ⚡ Improving performance with enhanced benchmarking.\n\nWe look forward to your valuable contributions and ideas 💡! Let’s make gofast even faster together! 🎉\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraghavgh%2Fgofast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraghavgh%2Fgofast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraghavgh%2Fgofast/lists"}