Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alex19pov31/cache-manager
Небольшой модуль для кеширования данных: file storage, memcached, redis, etcd.
https://github.com/alex19pov31/cache-manager
cache etcd memcached python redis
Last synced: about 1 month ago
JSON representation
Небольшой модуль для кеширования данных: file storage, memcached, redis, etcd.
- Host: GitHub
- URL: https://github.com/alex19pov31/cache-manager
- Owner: alex19pov31
- Created: 2020-10-05T21:12:18.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-14T22:17:33.000Z (over 4 years ago)
- Last Synced: 2024-11-18T22:54:13.313Z (2 months ago)
- Topics: cache, etcd, memcached, python, redis
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Cache manager
Простой кеш - хранение в файлах:
```python
from cache_manager.pickle import PickleCache
from datetime import timedeltacache_manager = PickleCache('./cache')
@cache_manager(ttl=timedelta(hours=1))
def some_function():
pass
```Memcached:
```python
from cache_manager.memcached import MemcachedCache
from datetime import timedeltacache_manager = MemcachedCache(('10.5.0.11', 11211)) # в случае соединения по TCP или UDP сокету
cache_manager = MemcachedCache('/usr/run/memcached.sock') # в случае соединия по unix сокету@cache_manager(ttl=timedelta(hours=1))
def some_function():
pass
```Redis:
```python
from cache_manager.redis import RedisCache
from datetime import timedeltacache_manager = RedisCache(('10.5.0.11', 6379), password='somepassword') # в случае соединения по TCP или UDP сокету
cache_manager = RedisCache('/usr/run/redis.sock', password='somepassword') # в случае соединия по unix сокету@cache_manager(ttl=timedelta(hours=1))
def some_function():
pass
```Etcd:
```python
from cache_manager.etcd import EtcdCache
from datetime import timedeltacache_manager = EtcdCache(('10.5.0.11', 2371), scheme='http')
@cache_manager(ttl=timedelta(hours=1))
def some_function():
pass
```