{"id":17739042,"url":"https://github.com/pierrekieffer/cache-operator","last_synced_at":"2025-03-31T19:44:53.332Z","repository":{"id":120128908,"uuid":"307652360","full_name":"PierreKieffer/cache-operator","owner":"PierreKieffer","description":"Provides simple caching method","archived":false,"fork":false,"pushed_at":"2020-11-19T10:46:05.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-03-07T01:31:41.304Z","etag":null,"topics":["cache-storage","caching","memoization","memory","python","python-cache"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PierreKieffer.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":"2020-10-27T09:44:47.000Z","updated_at":"2020-11-19T10:46:07.000Z","dependencies_parsed_at":"2024-06-12T01:20:05.037Z","dependency_job_id":null,"html_url":"https://github.com/PierreKieffer/cache-operator","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PierreKieffer%2Fcache-operator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PierreKieffer%2Fcache-operator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PierreKieffer%2Fcache-operator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PierreKieffer%2Fcache-operator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PierreKieffer","download_url":"https://codeload.github.com/PierreKieffer/cache-operator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246531986,"owners_count":20792735,"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":["cache-storage","caching","memoization","memory","python","python-cache"],"created_at":"2024-10-26T02:07:12.488Z","updated_at":"2025-03-31T19:44:53.309Z","avatar_url":"https://github.com/PierreKieffer.png","language":"Python","readme":"# cache-operator\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"logo.png\"\u003e\n\u003c/p\u003e\n\ncache-operator provides simple caching method.\n\nAllows to cache the return values of a function depending on the arguments.\nIt can save time when an I/O bound function is periodically called with the same arguments.\n\n## Install \n```bash\npip install .\n```\n\n## Usage\n```python\n# import\nfrom cache_operator import cache\n\n# call cache decorator\n@cache\ndef worker(*args, **kwargs): \n    pass\n\n# To clean cache for associated method, call the method with clean_cache=True\n```\n\nExample:\n```python\nfrom cache_operator import cache\nimport time\n\n@cache\ndef worker(i, k=2): \n    print(\"computing ...\")\n    time.sleep(2)\n    return i*k \n\nif __name__==\"__main__\":\n\n    print(\"First run\")\n    res = worker(1,2)\n    print(res)\n    print(\"------------\")\n\n    print(\"Second run\")\n    res = worker(1,2)\n    print(res)\n\n    print(\"------------\")\n    print(\"Clean cache\")                                                                                              \n    worker(clean_cache=True)\n```\n\nOutput : \n```\nFirst run\ncomputing ...\n2\n------------\nSecond run\n2\n------------\nClean cache\n\n```\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpierrekieffer%2Fcache-operator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpierrekieffer%2Fcache-operator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpierrekieffer%2Fcache-operator/lists"}