cacheia-decorators


Namecacheia-decorators JSON
Version 1.0.0.post3 PyPI version JSON
download
home_pageNone
SummaryDecorates for Cacheia library that allows invalidation and other shenanigans
upload_time2024-07-24 17:50:28
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseNone
keywords cache decorator method
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Cacheia Decorators

Exposes decorators that can be used along FastAPI and plain functions to cache responses using cacheia machinery.

## Installation

Install decorators with "schemas" optional and "local" and "remote" cache support:

```bash
pip install -e ./decorators[schemas,local,remote]
```

## Code

There are these decorators avaialble:

-   `local.cache`: which can be used on plain functions to cache values using a local cache or cacheia_client.
-   `remote.cache`: which can be used to cache values on a remote instance of cacheia (i.e. cacheia_api service).

## Usage

```python
from cacheia_decorators.local import cache as local_cache
from cacheia_decorators.remote import cache as remote_cache


@local_cache(key_builder=lambda i: str(i == 0), settings={})
def function_a():
    return "Hello World"

@remote_cache(key_builder=lambda i: str(i == 0), url="http://localhost:5000/")
def function_b():
    return "Hello World"
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cacheia-decorators",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "cache, decorator, method",
    "author": null,
    "author_email": "TeiaLabs <contato@teialabs.com>",
    "download_url": "https://files.pythonhosted.org/packages/ca/e6/5a5799c62dbc6eebcd9dd57f4bfe535fb9dee3bd45ac0640a2b7bbca34d3/cacheia_decorators-1.0.0.post3.tar.gz",
    "platform": null,
    "description": "# Cacheia Decorators\n\nExposes decorators that can be used along FastAPI and plain functions to cache responses using cacheia machinery.\n\n## Installation\n\nInstall decorators with \"schemas\" optional and \"local\" and \"remote\" cache support:\n\n```bash\npip install -e ./decorators[schemas,local,remote]\n```\n\n## Code\n\nThere are these decorators avaialble:\n\n-   `local.cache`: which can be used on plain functions to cache values using a local cache or cacheia_client.\n-   `remote.cache`: which can be used to cache values on a remote instance of cacheia (i.e. cacheia_api service).\n\n## Usage\n\n```python\nfrom cacheia_decorators.local import cache as local_cache\nfrom cacheia_decorators.remote import cache as remote_cache\n\n\n@local_cache(key_builder=lambda i: str(i == 0), settings={})\ndef function_a():\n    return \"Hello World\"\n\n@remote_cache(key_builder=lambda i: str(i == 0), url=\"http://localhost:5000/\")\ndef function_b():\n    return \"Hello World\"\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Decorates for Cacheia library that allows invalidation and other shenanigans",
    "version": "1.0.0.post3",
    "project_urls": null,
    "split_keywords": [
        "cache",
        " decorator",
        " method"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "60d4b5a6fc94e19164a1f8f3c2ed62c06db5d31c9e3afbda7533148ec0bb52ed",
                "md5": "d6fbaf70d8f97ac282c1cc04f244a369",
                "sha256": "7503b4c10c494026bf4190edd95c1b6a740dd125f62f23e9f52030e4cd8fcfd1"
            },
            "downloads": -1,
            "filename": "cacheia_decorators-1.0.0.post3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d6fbaf70d8f97ac282c1cc04f244a369",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 3197,
            "upload_time": "2024-07-24T17:50:27",
            "upload_time_iso_8601": "2024-07-24T17:50:27.066053Z",
            "url": "https://files.pythonhosted.org/packages/60/d4/b5a6fc94e19164a1f8f3c2ed62c06db5d31c9e3afbda7533148ec0bb52ed/cacheia_decorators-1.0.0.post3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cae65a5799c62dbc6eebcd9dd57f4bfe535fb9dee3bd45ac0640a2b7bbca34d3",
                "md5": "75d34c9a5732427d5c8ee22fe7e5096e",
                "sha256": "4a7472bfde6062474605cacdaa94e282b9054e65105e2121b9dffdc070a52ee6"
            },
            "downloads": -1,
            "filename": "cacheia_decorators-1.0.0.post3.tar.gz",
            "has_sig": false,
            "md5_digest": "75d34c9a5732427d5c8ee22fe7e5096e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 2469,
            "upload_time": "2024-07-24T17:50:28",
            "upload_time_iso_8601": "2024-07-24T17:50:28.485516Z",
            "url": "https://files.pythonhosted.org/packages/ca/e6/5a5799c62dbc6eebcd9dd57f4bfe535fb9dee3bd45ac0640a2b7bbca34d3/cacheia_decorators-1.0.0.post3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-24 17:50:28",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "cacheia-decorators"
}
        
Elapsed time: 0.71772s