An elegant cache library for python
Project description
Build Status PyPI - Python Version PyPI - License Codecov branch
sponge
An elegant cache library for python
How to use
Install
pip install sponge
Usage
from sponge import CacheManager
# config cache manager
manager = CacheManager({
'default': 'redis',
'redis': {
'host': 'localhost',
'port': 3306,
'db': 0
},
'memory': {}
})
# get cache instance
cache = manager.store('redis')
# set cache
cache.put('mykey', 'myvalue', 30) # 30 seconds
cache.get('mykey') # myvalue
# remove cache
cache.forget('mykey')
# cache fover
cache.fover('mykey', 1)
# increase
cache.increase('mykey') # the value will be 2
# decrease
cache.decrease('mykey', 2) # the value will be -1
# clear all
cache.flush()
TODO
[ ] Support cache events
[ ] Support file driver
[ ] Support database driver
[ ] Added into awesome-python
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
sponge-0.0.8.tar.gz
(18.2 kB
view details)
File details
Details for the file sponge-0.0.8.tar.gz
.
File metadata
- Download URL: sponge-0.0.8.tar.gz
- Upload date:
- Size: 18.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
bdeb5f4fb855d4c67a78f50b4c25beebf8967fb9a85408c5f1c6165cafececf9
|
|
MD5 |
61e9180a26e9f53b1e58e7c9729ab00f
|
|
BLAKE2b-256 |
ed5bc86fcb7e9d4bfe38d3ec878b62f2fe617e3c676254117cff24d5be45a694
|