reche


Namereche JSON
Version 0.1.2 PyPI version JSON
download
home_pageNone
SummaryReche (Redis Cache) is a Python library that provides a simple interface for caching data in Redis.
upload_time2025-03-10 22:38:54
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords async cache decorator redis
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Reche (Redis Cache)

> Python библиотека, которая предоставляет декоратор для кэширования результатов функций в Redis, поддерживая различные форматы сериализации и стратегии кэширования, а также асинхронные операции.

## Установка

---

### 📥 Установка из Git-репозитория

#### Для pip
```bash
pip install git+https://gitlab.com/Randommist/reche.git
```

#### Для uv
```bash
uv add git+https://gitlab.com/Randommist/reche.git
```

#### Для poetry
```bash
poetry add git+https://gitlab.com/Randommist/reche.git
```

---

### 📦 Установка из PyPI

#### Для pip
```bash
pip install reche
```

#### Для uv
```bash
uv add reche
```

#### Для poetry
```bash
poetry add reche
```

---

## Использование (sync)
```python
import time
import redis
from reche import RedisCache


redis_client = redis.Redis(host="localhost", port=6379, db=0)
redis_cache = RedisCache(redis_client)

@redis_cache.cache()
def sum(a: int, b: int) -> int:
    time.sleep(3)
    return a + b

result = sum(1, 2)  # ожидание 3 секунды
print(result)

result = sum(1, 2)  # моментально
print(result)
```

## Использование (async)
```python
import asyncio
import redis.asyncio as redis
from reche import RedisCache


redis_client = redis.Redis(host="localhost", port=6379, db=0)
redis_cache = RedisCache(redis_client)

@redis_cache.cache()
async def sum(a: int, b: int) -> int:
    await asyncio.sleep(3)
    return a + b

async def main():
    result = await sum(1, 2)  # ожидание 3 секунды
    print(result)

    result = await sum(1, 2)  # моментально
    print(result)

if __name__ == "__main__":
    asyncio.run(main())
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "reche",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "async, cache, decorator, redis",
    "author": null,
    "author_email": "Randommist <andrey18s@yandex.ru>",
    "download_url": "https://files.pythonhosted.org/packages/4e/cd/59435e861f62edff9683997723a4eb4b3e06887fc167221c80ea70e4598f/reche-0.1.2.tar.gz",
    "platform": null,
    "description": "# Reche (Redis Cache)\n\n> Python \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 \u0434\u043b\u044f \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432 Redis, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u044b \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438.\n\n## \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430\n\n---\n\n### \ud83d\udce5 \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438\u0437 Git-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f\n\n#### \u0414\u043b\u044f pip\n```bash\npip install git+https://gitlab.com/Randommist/reche.git\n```\n\n#### \u0414\u043b\u044f uv\n```bash\nuv add git+https://gitlab.com/Randommist/reche.git\n```\n\n#### \u0414\u043b\u044f poetry\n```bash\npoetry add git+https://gitlab.com/Randommist/reche.git\n```\n\n---\n\n### \ud83d\udce6 \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438\u0437 PyPI\n\n#### \u0414\u043b\u044f pip\n```bash\npip install reche\n```\n\n#### \u0414\u043b\u044f uv\n```bash\nuv add reche\n```\n\n#### \u0414\u043b\u044f poetry\n```bash\npoetry add reche\n```\n\n---\n\n## \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 (sync)\n```python\nimport time\nimport redis\nfrom reche import RedisCache\n\n\nredis_client = redis.Redis(host=\"localhost\", port=6379, db=0)\nredis_cache = RedisCache(redis_client)\n\n@redis_cache.cache()\ndef sum(a: int, b: int) -> int:\n    time.sleep(3)\n    return a + b\n\nresult = sum(1, 2)  # \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 3 \u0441\u0435\u043a\u0443\u043d\u0434\u044b\nprint(result)\n\nresult = sum(1, 2)  # \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\nprint(result)\n```\n\n## \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 (async)\n```python\nimport asyncio\nimport redis.asyncio as redis\nfrom reche import RedisCache\n\n\nredis_client = redis.Redis(host=\"localhost\", port=6379, db=0)\nredis_cache = RedisCache(redis_client)\n\n@redis_cache.cache()\nasync def sum(a: int, b: int) -> int:\n    await asyncio.sleep(3)\n    return a + b\n\nasync def main():\n    result = await sum(1, 2)  # \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 3 \u0441\u0435\u043a\u0443\u043d\u0434\u044b\n    print(result)\n\n    result = await sum(1, 2)  # \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\n    print(result)\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Reche (Redis Cache) is a Python library that provides a simple interface for caching data in Redis.",
    "version": "0.1.2",
    "project_urls": {
        "Code": "https://gitlab.com/Randommist/reche",
        "Homepage": "https://gitlab.com/Randommist/reche",
        "Issues": "https://gitlab.com/Randommist/reche/-/issues"
    },
    "split_keywords": [
        "async",
        " cache",
        " decorator",
        " redis"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "65ac89ef850fbc42722e17e53a9d8e4bc3607da5a9babd249fe79574d854aeb5",
                "md5": "66a8fefadabea7fad734c6be4a2c689d",
                "sha256": "c320a7a074e74596d9866eeb5a02fe68f24dbed8872f1d5fd4ea9d0be0eea800"
            },
            "downloads": -1,
            "filename": "reche-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "66a8fefadabea7fad734c6be4a2c689d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 4507,
            "upload_time": "2025-03-10T22:38:53",
            "upload_time_iso_8601": "2025-03-10T22:38:53.289715Z",
            "url": "https://files.pythonhosted.org/packages/65/ac/89ef850fbc42722e17e53a9d8e4bc3607da5a9babd249fe79574d854aeb5/reche-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "4ecd59435e861f62edff9683997723a4eb4b3e06887fc167221c80ea70e4598f",
                "md5": "eccdc83e74d80e8835a14b8c67f48114",
                "sha256": "bfecab9e283bea60dd30f90a8161898b6c8a07cacfe8285e0c02e84ad9bb8e49"
            },
            "downloads": -1,
            "filename": "reche-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "eccdc83e74d80e8835a14b8c67f48114",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 10636,
            "upload_time": "2025-03-10T22:38:54",
            "upload_time_iso_8601": "2025-03-10T22:38:54.593661Z",
            "url": "https://files.pythonhosted.org/packages/4e/cd/59435e861f62edff9683997723a4eb4b3e06887fc167221c80ea70e4598f/reche-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-03-10 22:38:54",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "Randommist",
    "gitlab_project": "reche",
    "lcname": "reche"
}
        
Elapsed time: 0.43709s