a simple cache lib support memory、file、redis
Project description
Mo-Cache
a simple cache lib support memory、file、redis
install
pip install mo-cache
demo
from mo_cache import cache_decorator
cache = cache_decorator('memory')
@cache
def foo(a, b):
return a + b
if __name__ == '__main__':
foo()
继承体系
from abc import ABC
class CacheAbstract(ABC):
"""统一的接口"""
def set(self, key, value, expire=-1):
pass
def get(self, key):
pass
class MemoryCache(CacheAbstract):
"""内存缓存"""
class FileCache(CacheAbstract):
"""文件缓存"""
class RedisCache(CacheAbstract):
"""Redis 缓存"""
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
mo-cache-0.0.4.tar.gz
(4.5 kB
view hashes)