A low level cache library.
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cachecore-0.4.0.tar.gz
(7.8 kB
view details)
Built Distribution
File details
Details for the file cachecore-0.4.0.tar.gz
.
File metadata
- Download URL: cachecore-0.4.0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b626b39110ad767e6bf4f830f1ad2646d363f55155970e2a8fe1510a2ff77ac3 |
|
MD5 | 2d42188c6d0d394608fdb0870be8889a |
|
BLAKE2b-256 | f5e947a001ea0d76d33f2107817f55607d4f3cea118c3a96dedfb313b61d27f1 |
File details
Details for the file cachecore-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: cachecore-0.4.0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcb06cd559108dd64a6869acd8949cd64c84c037373d1e413cd9534e25ebee9a |
|
MD5 | 54dcbab8dca5cf5b9751e742a62015f3 |
|
BLAKE2b-256 | 12e0e8bf35cab8867c4eb2ee22dcaa881d0d051ba62de704130474e0d5fd0bce |