cachecore
A low-level caching library with multiple implementations.
Can be used as a stand-alone cacheing library or can be used to create higher level caching libraries.
Basics
Get, set, delete, and check for the existence of a key using the following.
>>> import cachecore
>>> cache = cachecore.LocalCache()
>>> cache.set('a', 1)
>>> cache.get('a')
1
>>> cache.exists('a')
True
>>> cache.delete('a')
True
>>> cache.exists('a')
False
>>> cache.get('a')
None
Complete API
__getitem__(self, key: str) -> Any:
__setitem__(self, key: str, value: Any):
__delitem__(self, key: str):
__contains__(self, key: str):
__iter__(self):
__len__(self):
keys(self, pattern: str = None):
get(self, key: str, default: Any = None) -> Any:
set(self, key: str, value: Any, ttl: Optional[int] = None):
add(self, key: str, value: Any, ttl: Optional[int] = None) -> bool:
replace(self, key: str, value: Any, ttl: Optional[int] = KEEP_TTL) -> bool:
delete(self, key: str) -> bool:
pop(self, key: str, default: Any = None):
exists(self, key: str) -> bool:
get_many(self, keys: Iterable[str], default: Any = None) -> Iterable[Any]:
set_many(self, mapping: Iterable[tuple[str, Any]], ttl: Optional[int] = None):
delete_many(self, keys: Iterable[str]) -> Iterable[bool]:
get_ttl(self, key: str, default: int = 0) -> Optional[int]:
set_ttl(self, key: str, ttl: Optional[int] = None) -> bool:
incr(self, key, delta=1) -> int:
decr(self, key, delta=1) -> int:
clear(self):
Cache Implementations
- Redis
- Memcached
- File System
- Local Memory
- Dummy
Metadata
Release files for cachecore 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cachecore-0.4.0.tar.gz | 7.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cachecore-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.6 kB
Release files / cachecore-0.4.0.tar.gz
| Download URL | cachecore-0.4.0.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b626b39110ad767e6bf4f830f1ad2646d363f55155970e2a8fe1510a2ff77ac3
|
|
BLAKE2b-256 checksum How to use checksums |
f5e947a001ea0d76d33f2107817f55607d4f3cea118c3a96dedfb313b61d27f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.10.2
|
Release files / cachecore-0.4.0-py3-none-any.whl
| Download URL | cachecore-0.4.0-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bcb06cd559108dd64a6869acd8949cd64c84c037373d1e413cd9534e25ebee9a
|
|
BLAKE2b-256 checksum How to use checksums |
12e0e8bf35cab8867c4eb2ee22dcaa881d0d051ba62de704130474e0d5fd0bce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.10.2
|