{"id":15009879,"url":"https://github.com/atmb4u/cashier","last_synced_at":"2025-04-09T17:52:34.807Z","repository":{"id":62560954,"uuid":"86184182","full_name":"atmb4u/cashier","owner":"atmb4u","description":"Persistent caching for python functions","archived":false,"fork":false,"pushed_at":"2023-07-01T14:04:43.000Z","size":14,"stargazers_count":87,"open_issues_count":9,"forks_count":9,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-23T19:51:32.459Z","etag":null,"topics":["cache","cashier","functions","persistent","python","python-functions","python2","python3"],"latest_commit_sha":null,"homepage":"https://atmb4u.github.io/cashier","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/atmb4u.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":"2017-03-25T19:45:44.000Z","updated_at":"2025-02-08T01:48:13.000Z","dependencies_parsed_at":"2024-06-19T16:01:56.222Z","dependency_job_id":"75d05a66-6afe-4efd-9e58-9f5b94badf73","html_url":"https://github.com/atmb4u/cashier","commit_stats":{"total_commits":27,"total_committers":1,"mean_commits":27.0,"dds":0.0,"last_synced_commit":"cccd3efff98279ece5ed50f4c835e18a3e68f4a3"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atmb4u%2Fcashier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atmb4u%2Fcashier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atmb4u%2Fcashier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atmb4u%2Fcashier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atmb4u","download_url":"https://codeload.github.com/atmb4u/cashier/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247601447,"owners_count":20964864,"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","cashier","functions","persistent","python","python-functions","python2","python3"],"created_at":"2024-09-24T19:29:00.850Z","updated_at":"2025-04-09T17:52:34.770Z","avatar_url":"https://github.com/atmb4u.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Cashier\n-\n_Persistent caching for python functions_\n\n\nSimply add a decorator to a python function and cache the results for future use. Extremely handy when you are dealing with I/O heavy operations which seldom changes or CPU intensive functions as well.\n\nAnatomically, once a function is called, result from the function is cached into an SQLite3 database locally, with an expiry time. There is a maximum length for the cache to prevent cache flooding the file system.\n\n\nInstallation\n-\n\n```pip install cashier```\n\nOr you can clone the source and run setup.py\n\n```bash\ngit clone git@github.com:atmb4u/cashier.git\ncd cashier\npython setup.py install\n```\n\n\nUsage\n-\n\n\n\n```python\nfrom cashier import cache\n\n@cache()\ndef complex_function(a,b,c,d):\n    return complex_calculation(a,b,c,d)\n```\n\nIf you go ahead on the above configuration, following are the default values\n\n* cache_file :  `.cache`\n\n* cache_time : `84600`\n* cache_length : `10000`\n* retry_if_blank : `False`\n\n\nAdvanced Usage\n-\n\n\n```python\nfrom cashier import cache\n\n@cache(cache_file=\"sample.db\", cache_time=7200, cache_length=1000, \n       retry_if_blank=True)\ndef complex_function(a, b, c, d):\n    return complex_calculation(a, b, c, d)\n```\n\n\n`cache_file` : SQLite3 file name to which cached data should be written into (defaults to .cache)\n\n`cache_time` : how long should the data be cached in seconds (defaults to 1 day)\n\n`cache_length` : how many different arguments and corresponding data should be cached (defaults to 10000)\n\n`retry_if_blank` : If True, will retry for the data if blank data is cached ( default is `False`)\n\n\nPerformance Benchmark\n-\n\nFor reproducing results, run `python test.py` from the project root.\n\nNo Cache Run: **9.932126 seconds**\n\nFirst Caching Run: **9.484081 seconds**\n\nCached Run: **0.606016 seconds (16 x faster)**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatmb4u%2Fcashier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatmb4u%2Fcashier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatmb4u%2Fcashier/lists"}