a simple cache lib support memory、file、redis
Project description
Mo-Cache
a simple cache lib support memory、file、redis
Github: https://github.com/mouday/mo-cache
install
pip install mo-cache
demo
from mo_cache import MemoryCache
cache = MemoryCache()
@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 CacheDecorator(CacheAbstract):
"""cache 装饰器"""
class MemoryCache(CacheDecorator):
"""内存缓存"""
class FileCache(CacheDecorator):
"""文件缓存"""
class RedisCache(CacheDecorator):
"""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.5.tar.gz
(4.5 kB
view hashes)