redis-cache-deco


Nameredis-cache-deco JSON
Version 1.0.7 PyPI version JSON
download
home_pagehttps://github.com/snuids/redis_cache_deco
SummaryA decorator that memoized into redis
upload_time2023-10-19 09:27:23
maintainer
docs_urlNone
authorsnuids
requires_python
license
keywords python memoize decorator redis
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Redis Cache Decorator

## Installation

```bash
pip install redis-cache-deco
```

# Example

```python
from datetime import datetime
import redis
from redis_cache_deco import rcd

rcd.init_redis_cache(redis.Redis(host='localhost', port=6379, db=0))

@rcd.use_redis_cache(ttl=60)
def my_function(dt,array):
    print("My Function")
    return {"dt":dt,"array":array,"ret":"OK"}

res=my_function(datetime(2021,1,1,1,1),[{"a":1}])
print(res)


rcd.cache_stats()
```

## parameters

init_redis_cache(redis_client_in,prefix_in="",debug_in=False)

* prefix_in: The prefix to use in redis
* debug_in: Bypass the redis cache
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/snuids/redis_cache_deco",
    "name": "redis-cache-deco",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Python,memoize,decorator,redis",
    "author": "snuids",
    "author_email": "snuids@mannekentech.com",
    "download_url": "https://files.pythonhosted.org/packages/08/4c/22906a6f04d893f1ebbbbe5bdecdea3b5aeeaca84bde6cc4a1705c618f1c/redis_cache_deco-1.0.7.tar.gz",
    "platform": null,
    "description": "# Redis Cache Decorator\n\n## Installation\n\n```bash\npip install redis-cache-deco\n```\n\n# Example\n\n```python\nfrom datetime import datetime\nimport redis\nfrom redis_cache_deco import rcd\n\nrcd.init_redis_cache(redis.Redis(host='localhost', port=6379, db=0))\n\n@rcd.use_redis_cache(ttl=60)\ndef my_function(dt,array):\n    print(\"My Function\")\n    return {\"dt\":dt,\"array\":array,\"ret\":\"OK\"}\n\nres=my_function(datetime(2021,1,1,1,1),[{\"a\":1}])\nprint(res)\n\n\nrcd.cache_stats()\n```\n\n## parameters\n\ninit_redis_cache(redis_client_in,prefix_in=\"\",debug_in=False)\n\n* prefix_in: The prefix to use in redis\n* debug_in: Bypass the redis cache",
    "bugtrack_url": null,
    "license": "",
    "summary": "A decorator that memoized into redis",
    "version": "1.0.7",
    "project_urls": {
        "Download": "https://github.com/snuids/redis_cache_deco/archive/1.0.7.tar.gz",
        "Homepage": "https://github.com/snuids/redis_cache_deco"
    },
    "split_keywords": [
        "python",
        "memoize",
        "decorator",
        "redis"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "084c22906a6f04d893f1ebbbbe5bdecdea3b5aeeaca84bde6cc4a1705c618f1c",
                "md5": "a35b77fded75dc6ec2f11d30a0a93ce1",
                "sha256": "080b618be73c8986c5e3fd43e41fbabc39f9a1c33e91cf49ef6f8d951ef0f2d6"
            },
            "downloads": -1,
            "filename": "redis_cache_deco-1.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "a35b77fded75dc6ec2f11d30a0a93ce1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 2136,
            "upload_time": "2023-10-19T09:27:23",
            "upload_time_iso_8601": "2023-10-19T09:27:23.202443Z",
            "url": "https://files.pythonhosted.org/packages/08/4c/22906a6f04d893f1ebbbbe5bdecdea3b5aeeaca84bde6cc4a1705c618f1c/redis_cache_deco-1.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-19 09:27:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "snuids",
    "github_project": "redis_cache_deco",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "redis-cache-deco"
}
        
Elapsed time: 0.19856s