No project description provided
Project description
Python Simple Cache - scache
Installation
$ [sudo] pip install scache
How it works
scache uses .json files in the data subdirectory by default. If they exist, they are overwritten. If they do not, they are created.
./data/<key>.json
by default
Get Started
'''Optional parameters:
path: (string) Path where to store the .json cache data.
defaults to './data/'
debug: (boolean) Prints debug information such as whether or not keys were found.
defaults to False
'''
from scache import SCache
scache = SCache()
scache.set('key', 'value')
Functions
function | __doc__ |
---|---|
scache.get(key) |
Gets cache value. |
scache.get(key, value) |
Sets cache value. |
scache.get(key, default) |
Get cache value. Return default if not found |
scache.rm(key) |
Remove cache by key |
scache.exists(key) |
returns True if key exists, else returns False |
scache.empty() |
Clears the entire cache. |
Examples
>>> import scache
>>> scache.set("key", {'test': 1})
>>> scache.get("key")
"{'test': 1}"
>>> scache.exists("key")
True
>>> scache.rm("key")
>>> scache.empty() # clears entire cache
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
scache-1.3.0.tar.gz
(3.1 kB
view details)
Built Distribution
File details
Details for the file scache-1.3.0.tar.gz
.
File metadata
- Download URL: scache-1.3.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.8.0 tqdm/4.43.0 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | baed7741b7ce0a36a96ddd6efc28496322705bd60de425ac4650167b5f592914 |
|
MD5 | 28011aa5aaa60fa07b6312e0e17afc4f |
|
BLAKE2b-256 | cbf19515d0d3ff97301961371f3c778555755c98ceec05f8edfec4ee5a354cce |
File details
Details for the file scache-1.3.0-py3-none-any.whl
.
File metadata
- Download URL: scache-1.3.0-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.8.0 tqdm/4.43.0 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f5ec1f33cb85f20d819ae65b503629d4acb5280965d92f524b79c988cf8888f |
|
MD5 | 5a4eb0100ec35298d1e1ed0f0b5a5bf1 |
|
BLAKE2b-256 | cd86670b9c4a3be66b2b0a26a916872fb5ae355293007bcad3d0bac40acfd1a1 |