{"id":39188391,"url":"https://github.com/atlekbai/go-memofy","last_synced_at":"2026-01-17T22:40:59.429Z","repository":{"id":57525095,"uuid":"248534133","full_name":"atlekbai/go-memofy","owner":"atlekbai","description":"Simple, In-Memory cache for function calls. Cache function call results.","archived":false,"fork":false,"pushed_at":"2020-03-19T15:13:24.000Z","size":5,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T01:59:12.409Z","etag":null,"topics":["cache","calls","function","lru-cache"],"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/atlekbai.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-03-19T15:11:04.000Z","updated_at":"2021-07-04T21:42:33.000Z","dependencies_parsed_at":"2022-08-26T04:01:46.308Z","dependency_job_id":null,"html_url":"https://github.com/atlekbai/go-memofy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/atlekbai/go-memofy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atlekbai%2Fgo-memofy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atlekbai%2Fgo-memofy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atlekbai%2Fgo-memofy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atlekbai%2Fgo-memofy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atlekbai","download_url":"https://codeload.github.com/atlekbai/go-memofy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atlekbai%2Fgo-memofy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28521165,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T22:11:28.393Z","status":"ssl_error","status_checked_at":"2026-01-17T22:11:27.841Z","response_time":85,"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","calls","function","lru-cache"],"created_at":"2026-01-17T22:40:58.979Z","updated_at":"2026-01-17T22:40:59.425Z","avatar_url":"https://github.com/atlekbai.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# memofy - cache function calls\n\nPackage `memofy` implements a cache for function calls. It can save time when an expensive or I/O bound function is periodically called with the same arguments.\n\nHighly inspired by [lru_cache](https://docs.python.org/3/library/functools.html#functools.lru_cache) Python3 decorator.\n\nForked from [go-memoize](https://github.com/kofalt/go-memoize) and reimplemented to be more similar to [lru_cache](https://docs.python.org/3/library/functools.html#functools.lru_cache).\n\n## Install\n\n```sh\ngo get -u github.com/atlekbai/go-memofy\n```\n\n## Examples\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"time\"\n    \"github.com/atlekbai/go-memofy\"\n)\n\nfunc main() {\n    expensiveSumFunction := func(a, b int) int {\n\t\ttime.Sleep(2 * time.Second)\n\t\treturn a + b\n    }\n\n    // Cache expensive calls in memory for 90 seconds, purging old entries every 10 minutes.\n\tcache := memofy.NewMemofier(90*time.Second, 10*time.Minute)\n\n    // first call will take 2 seconds and save to cache computed values\n    result, cached, err := cache.Memofy(expensiveSumFunction, 5, 7)\n    // second call will return cached value\n    result, cached, err = cache.Memofy(expensiveSumFunction, 5, 7)\n\n    // result returns []interface{}, because function can return multiple values\n    returnValues := result.([]interface{})\n\n    // [12]\n    fmt.Println(returnValues)\n\n    // cast to int to retrieve function return value\n    sumValue := returnValues[0].(int)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatlekbai%2Fgo-memofy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatlekbai%2Fgo-memofy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatlekbai%2Fgo-memofy/lists"}