{"id":19234424,"url":"https://github.com/depthbomb/pepper-cache","last_synced_at":"2026-06-15T12:32:12.222Z","repository":{"id":107227710,"uuid":"529140475","full_name":"depthbomb/pepper-cache","owner":"depthbomb","description":"A simple, persistent key/value cache with no dependencies.","archived":false,"fork":false,"pushed_at":"2022-11-19T03:13:51.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-06-01T23:06:12.792Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/depthbomb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-08-26T06:23:05.000Z","updated_at":"2022-12-15T00:36:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"328f0b94-96fd-48e4-be5b-afbaec3628f2","html_url":"https://github.com/depthbomb/pepper-cache","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/depthbomb/pepper-cache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depthbomb%2Fpepper-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depthbomb%2Fpepper-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depthbomb%2Fpepper-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depthbomb%2Fpepper-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/depthbomb","download_url":"https://codeload.github.com/depthbomb/pepper-cache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/depthbomb%2Fpepper-cache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34363538,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-15T02:00:07.085Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-09T16:13:43.813Z","updated_at":"2026-06-15T12:32:12.214Z","avatar_url":"https://github.com/depthbomb.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pepper-cache\n\n[![PyPI](https://img.shields.io/pypi/v/pepper-cache?color=0073b7\u0026label=version\u0026logo=python\u0026logoColor=white\u0026style=flat-square) ![PyPI - Downloads](https://img.shields.io/pypi/dd/pepper-cache?color=0073b7\u0026logo=python\u0026logoColor=white\u0026style=flat-square)](https://pypi.org/project/pepper-cache/)\n\nA simple, persistent key/value cache with no dependencies.\n\n## Installation\n\n```shell\n$ pip install pepper-cache\n```\n\n## API\n\n- `create_cache` - Creates a Cache instance.\n  - `name: str|Path` - The name of the cache instance, also used for the directory relative to `$HOME/.cache` if no `path` is supplied\n  - `path: str = None` - The directory in which to store cache files relative to `$HOME/.cache`\n  - `serializer: \"pickle\"|\"json\" = \"pickle\"` - The serializer to use when writing values to the disk, defaults to `\"pickle\"`\n```python\nmy_cache = create_cache(\"my cache\", path=\"my_app/my_cache\", serializer=\"json\")\nmy_cache = create_cache(\"my cache\")  # path arg omitted, path would be $HOME/.cache/my_cache\n```\n\n---\n\n- `get_cache` - Retrieves a Cache instance.\n  - `name: str` - The name of the cache instance to retrieve\n  - `create: bool` - Whether to create the cache if it does not exist\n```python\nmy_cache = get_cache(\"my cache\")\nmy_cache = get_cache(\"nonexistent cache\")  # None\nmy_cache = get_cache(\"nonexistent cache\", create=True)  # Now exists!\n```\n\n---\n\n- `Cache.set` - Sets an item in the cache. Existing items will be overwritten.\n  - `key: str` - The name of the cached value\n  - `value: Any` - The value to store\n  - `ttl: int = 0` - The time in milliseconds that the value should remain in the cache or 0  for indefinitely, defaults to `0`\n```python\ncache.set(\"my key\", my_value)  # stored indefinitely\ncache.set(\"my key\", my_value, ttl=1000)  # stored for one second\n```\n\n---\n\n- `Cache.get` - Retrieves a value from the cache if it exists and has not expired.\n  - `key: str` - The key of the cache item to retrieve\n  - `default: Any` - The default value to return if the value is not stored\n```python\nmy_value = cache.get(\"my key 2\")  # returns None if the value is not stored or has expired. Consider checking if the item exists below\nmy_value = cache.get(\"my key 2\", default=\"now has a value\")\n```\n\n---\n\n- `Cache.has` - Returns `True` if an item exists in the cache by its key.\n  - `key: str` - The key of the cache item to check the existence of\n```python\nif not cache.has(\"my key 2\"):\n    cache.set(\"my key 2\", \"has a value!\")\n```\n\n---\n\n- `Cache.delete` - Deletes an item from the cache if it exists.\n  - `key: str` - The key of the cache item to delete from the cache\n```python\ncache.delete(\"my key 2\"):\ncache.get(\"my key 2\")  # None\n```\n\n---\n\n\"pepper\" comes from the code name of a project of mine and instead of writing packages like this specifically for the project, I decided to instead make them full on Python packages that anyone can use.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdepthbomb%2Fpepper-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdepthbomb%2Fpepper-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdepthbomb%2Fpepper-cache/lists"}