Skip to main content

a simple cache lib support memory、file、redis

Project description

Mo-Cache

PyPI PyPI - Downloads PyPI - Python Version PyPI - License

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)

Uploaded Source

Built Distribution

mo_cache-0.0.5-py3-none-any.whl (7.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page