Cache system for python
Reason this release was yanked:
not work
Project description
SimpleCache
Usage
from SimpleCache2 import simple_cache
from SimpleCache2.FileCache import FileCache
cache = FileCache(cache_dir=None)
# Usage as decorator
@simple_cache(cache, ttl=10, key_prefix="test_")
def testFunc(name):
return f"hello world {name}"
# Usage as callback
cache.call(["cache key can be any value"], 10, testFunc, "Bob")
# Usage as functional
cache.set("key", "value") # self
cache.get("key") # value
cache.exist("key") # bool
cache.delete("key") # bool
cache.clearOld() # bool
Api
You can write you self cache class:
from SimpleCache2.CacheSystem import CacheSystem
class MyCacheClass(CacheSystem):
def exist(self, key: any) -> bool:
pass
def get(self, key: any) -> any:
pass
def set(self, key: any, value: object, ttl: int = 0) -> object:
return self
pass
def delete(self, key: any) -> bool:
pass
def clearOld(self):
pass
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
SimpleCache2-1.0.0.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for SimpleCache2-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7aad24e8b364abd0cd66e9eab2c79407774a27ac83d11fe07b36796979a98dc |
|
MD5 | 58e912e90a7c8aa59e9ee18518978e4f |
|
BLAKE2b-256 | fff3c6b3faca9ba601ae17432c9c62806b0e2734acf2c2b61c251b1546bc2945 |