redisdecor


Nameredisdecor JSON
Version 0.1.12.7 PyPI version JSON
download
home_pagehttps://github.com/AresJef/RedisDecor
SummaryProvides decorators to cache/update/delete results to/from Redis.
upload_time2023-11-08 04:25:20
maintainer
docs_urlNone
authorJiefu Chen
requires_python>=3.10
licenseMIT license, BSD 3-Clause
keywords redis decorator cache update delete
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## Provides decorators to cache/update/delete results to/from Redis.

Created to be used in a project, this package is published to github 
for ease of management and installation across different modules.

### Features
For function decorated with `@cache`, the result will be serialized and 
stored in Redis. If the function is called again with the same arguments
before the expiration, the value will be retrieved from Redis and deserialized
and reconstruct to its original (or compatible) python dtype.

Supported caching data types includes:
- boolean: `bool` & `numpy.bool_` -> deserialize to `bool`
- integer: `int` & `numpy.int` & `numpy.uint` -> deserialize to `int`
- float: `float` & `numpy.float_` -> deserialize to `float`
- decimal: `decimal.Decimal` -> deserialize to `decimal.Decimal`
- string: `str` -> deserialize to `str`
- bytes: `bytes` -> deserialize to `bytes`
- date: `datetime.date` -> deserialize to `datetime.date`
- time: `datetime.time` -> deserialize to `datetime.time`
- datetime: `datetime.datetime` & `pandas.Timestamp` -> deserialize to `datetime.datetime`
- datetime64*: `numpy.datetime64` & `time.struct_time` -> deserialize to `datetime.datetime`
- timedelta: `datetime.timedelta` & `pandas.Timedelta` -> deserialize to `datetime.timedelta`
- timedelta64: `numpy.timedelta64` -> deserialize to `datetime.timedelta`
- None: `None` & `numpy.nan` -> deserialize to `None`
- list: `list` of above supported data types -> deserialize to `list`
- tuple: `tuple` of above supported data types -> deserialize to `list`
- set: `set` of above supported data types -> deserialize to `list`
- frozenset: `frozenset` of above supported data types -> deserialize to `list`
- dict: `dict` of above supported data types -> deserialize to `dict`
- numpy.record: `numpy.record` of above supported data types -> deserialize to `list`
- numpy.ndarray: `numpy.ndarray` of above supported data types -> deserialize to `np.ndarray`
- pandas.Series: `pandas.Series` of above supported data types -> deserialize to `pandas.Series`
- pandas.DataFrame: `pandas.DataFrame` of above supported data types -> deserialize to `pandas.DataFrame`

### Installation
Install from `PyPi`
``` bash
pip install redisdecor
```

Install from `github`
``` bash
pip install git+https://github.com/AresJef/RedisDecor.git
```

### Compatibility
Only support for python 3.10 and above.

### Usage (Setup)
``` python
import redisdecor as rd
import datetime, numpy as np, pandas as pd
# Decorators in this package relies on `Redis`, which is a
# subclass of `redis.StrictRedis`. Besides the arguments
# `decode_responses` is fixed to False, this subclass works
# the same as `redis.StrictRedis`.
cl = rd.get_client(host="127.0.0.1", db=10)

# A shared 'expensive' function for all three decorators
def gen_data(rows: int, offset: int = 0) -> pd.DataFrame:
    # Add some delay to simulate expensiveness
    time.sleep(1)
    # Generate a pandas DataFrame
    tz = datetime.timezone(datetime.timedelta(hours=8), "CUS")
    dt = datetime.datetime.now()
    dt = datetime.datetime(2023, 1, 1, 1, 1, 1, 1)
    val = {
        "bool": True,
        "np_bool": np.bool_(False),
        "int": 1 + offset,
        "int64": np.int64(5 + offset),
        "unit": np.uint(5 + offset),
        "unit64": np.uint64(5 + offset),
        "float": 1.1 + offset,
        "float64": np.float64(4.4 + offset),
        "decimal": Decimal("3.3"),
        "str": "STRING",
        "bytes": b"BYTES",
        "datetime": dt + datetime.timedelta(offset),
        "datetime_tz": (dt + datetime.timedelta(offset)).replace(tzinfo=tz),
        "time": (dt + datetime.timedelta(hours=offset)).time(),
        "time_tz": (dt + datetime.timedelta(hours=offset)).time().replace(tzinfo=tz),
        "timedelta": datetime.timedelta(1 + offset),
        "None": None,
    }
    return pd.DataFrame([val for _ in range(rows)])

# Shared prefix for all three decorators
prefix = "test"

# @cache decorator - returns function value
@rd.cache(cl, prefix, 60)
def gen_data_cache(rows: int) -> pd.DataFrame:
    return gen_data(rows, 0)

# @update decorator - return bool | None
@rd.update(cl, prefix)
def gen_data_update(rows: int) -> bool | None:
    return gen_data(rows, 1)

# @delete decorator return bool | None
@rd.delete(cl, prefix) 
def gen_data_delete(rows: int) -> bool | None:
    return gen_data(rows, 0)
```

### Usage (Cache)
``` python
from timeit import timeit

# Flush keys
cl.flushall()

# First call - (no cache) - corresponding key: "test:100::"
print("No. cache - 100 row".ljust(20), timeit(lambda: gen_data_cache(100), number=1))
# No. cache - 100 row  1.0088350829901174

# Second call - (cache hit) - corresponding key: "test:100::"
print("Hit cache - 100 row".ljust(20), timeit(lambda: gen_data_cache(100), number=1))
# Hit cache - 100 row  0.002061583974864334

# Call with different arguments - (no cache) - corresponding key: "test:90::"
print("No. cache - 90 row".ljust(20), timeit(lambda: gen_data_cache(90), number=1))
# No. cache - 90 row   1.0119208749965765

# Second call - (cache hit) - corresponding key: "test:90::"
print("Hit cache - 90 row".ljust(20), timeit(lambda: gen_data_cache(90), number=1))
# Hit cache - 90 row   0.001857625029515475

# Data
print(gen_data_cache(100))
# <pandas.DataFrame>
# bool np_bool int int64 unit unit64 float ... bytes datetime datetime_tz time time_tz timedelta None
# 0 True False 1 5 5 5 1.1 ... 2023-01-01 01:01:01.000001 2023-01-01 01:01:01.000001+08:00 01:01:01.000001 01:01:01.000001+08:00 1 days None
# 1 True False 1 5 5 5 1.1 ... 2023-01-01 01:01:01.000001 2023-01-01 01:01:01.000001+08:00 01:01:01.000001 01:01:01.000001+08:00 1 days None
# 2 True False 1 5 5 5 1.1 ... 2023-01-01 01:01:01.000001 2023-01-01 01:01:01.000001+08:00 01:01:01.000001 01:01:01.000001+08:00 1 days None
# 3 True False 1 5 5 5 1.1 ... 2023-01-01 01:01:01.000001 2023-01-01 01:01:01.000001+08:00 01:01:01.000001 01:01:01.000001+08:00 1 days None
# 4 True False 1 5 5 5 1.1 ... 2023-01-01 01:01:01.000001 2023-01-01 01:01:01.000001+08:00 01:01:01.000001 01:01:01.000001+08:00 1 days None
# .. ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
# 95 True False 1 5 5 5 1.1 ... 2023-01-01 01:01:01.000001 2023-01-01 01:01:01.000001+08:00 01:01:01.000001 01:01:01.000001+08:00 1 days None
# 96 True False 1 5 5 5 1.1 ... 2023-01-01 01:01:01.000001 2023-01-01 01:01:01.000001+08:00 01:01:01.000001 01:01:01.000001+08:00 1 days None
# 97 True False 1 5 5 5 1.1 ... 2023-01-01 01:01:01.000001 2023-01-01 01:01:01.000001+08:00 01:01:01.000001 01:01:01.000001+08:00 1 days None
# 98 True False 1 5 5 5 1.1 ... 2023-01-01 01:01:01.000001 2023-01-01 01:01:01.000001+08:00 01:01:01.000001 01:01:01.000001+08:00 1 days None
# 99 True False 1 5 5 5 1.1 ... 2023-01-01 01:01:01.000001 2023-01-01 01:01:01.000001+08:00 01:01:01.000001 01:01:01.000001+08:00 1 days None
# [100 rows x 17 columns]
```

### Usage (Update)
``` python
# Update existing cache - corresponding key: "test:100::"
print("Update cache - 100 row".ljust(20), timeit(lambda: gen_data_update(100), number=1))
# Update cache - 100 row 1.0083019589656033
print("Update status:", gen_data_update(100)) # Will return True since the key exists.
# Update status: True

# Update non-exist cache - corresponding key: "test:80::"
print("Update miss - 80 row".ljust(20), timeit(lambda: gen_data_update(80), number=1))
# Update miss - 80 row   0.00012520799646154046
print("Update status:", gen_data_update(80)) # Will return False since the key does not exist.
# Update status: False

# Data
print(gen_data_cache(100)) # Call cache function to retrieve the updated data
# <pandas.DataFrame>
# bool np_bool int int64 unit unit64 float ... bytes datetime datetime_tz time time_tz timedelta None
# 0 True False 2 6 6 6 2.1 ... 2023-01-02 01:01:01.000001 2023-01-02 01:01:01.000001+08:00 02:01:01.000001 02:01:01.000001+08:00 2 days None
# 1 True False 2 6 6 6 2.1 ... 2023-01-02 01:01:01.000001 2023-01-02 01:01:01.000001+08:00 02:01:01.000001 02:01:01.000001+08:00 2 days None
# 2 True False 2 6 6 6 2.1 ... 2023-01-02 01:01:01.000001 2023-01-02 01:01:01.000001+08:00 02:01:01.000001 02:01:01.000001+08:00 2 days None
# 3 True False 2 6 6 6 2.1 ... 2023-01-02 01:01:01.000001 2023-01-02 01:01:01.000001+08:00 02:01:01.000001 02:01:01.000001+08:00 2 days None
# 4 True False 2 6 6 6 2.1 ... 2023-01-02 01:01:01.000001 2023-01-02 01:01:01.000001+08:00 02:01:01.000001 02:01:01.000001+08:00 2 days None
# .. ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
# 95 True False 2 6 6 6 2.1 ... 2023-01-02 01:01:01.000001 2023-01-02 01:01:01.000001+08:00 02:01:01.000001 02:01:01.000001+08:00 2 days None
# 96 True False 2 6 6 6 2.1 ... 2023-01-02 01:01:01.000001 2023-01-02 01:01:01.000001+08:00 02:01:01.000001 02:01:01.000001+08:00 2 days None
# 97 True False 2 6 6 6 2.1 ... 2023-01-02 01:01:01.000001 2023-01-02 01:01:01.000001+08:00 02:01:01.000001 02:01:01.000001+08:00 2 days None
# 98 True False 2 6 6 6 2.1 ... 2023-01-02 01:01:01.000001 2023-01-02 01:01:01.000001+08:00 02:01:01.000001 02:01:01.000001+08:00 2 days None
# 99 True False 2 6 6 6 2.1 ... 2023-01-02 01:01:01.000001 2023-01-02 01:01:01.000001+08:00 02:01:01.000001 02:01:01.000001+08:00 2 days None
# [100 rows x 17 columns]
```

### Usage (Delete)
``` python
# Delete existing cache - corresponding key: "test:100::"
print("Delete cache - 100 row".ljust(20), timeit(lambda: gen_date_delete(100), number=1))
# Delete cache - 100 row 0.00010604201816022396
print("Delete status:", gen_date_delete(100)) # Will return True since the key exists.
# Delete status: True

# Delete non-exist cache - corresponding key: "test:80::"
print("Delete miss - 80 row".ljust(20), timeit(lambda: gen_date_delete(80), number=1))
# Delete miss - 80 row   9.779195534065366e-05
print("Delete status:", gen_date_delete(80)) # Will return False since the key does not exist.
# Delete status: False

# Check cache - corresponding key: "test:80::"
print("Check key:", cl.get("test:100::"))
# Check key: None
```

### Acknowledgements
redisdecor is based on several open-source repositories.
- [hiredis](https://github.com/redis/hiredis-py)
- [redis](https://github.com/redis/redis)
- [serializor](https://github.com/AresJef/Serializor)


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/AresJef/RedisDecor",
    "name": "redisdecor",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "redis,decorator,cache,update,delete",
    "author": "Jiefu Chen",
    "author_email": "keppa1991@163.com",
    "download_url": "https://files.pythonhosted.org/packages/4b/f9/cfaba547cd4d2de448cb594433bb4eba2039cc4688c4d93292ee07e04c19/redisdecor-0.1.12.7.tar.gz",
    "platform": null,
    "description": "## Provides decorators to cache/update/delete results to/from Redis.\n\nCreated to be used in a project, this package is published to github \nfor ease of management and installation across different modules.\n\n### Features\nFor function decorated with `@cache`, the result will be serialized and \nstored in Redis. If the function is called again with the same arguments\nbefore the expiration, the value will be retrieved from Redis and deserialized\nand reconstruct to its original (or compatible) python dtype.\n\nSupported caching data types includes:\n- boolean: `bool` & `numpy.bool_` -> deserialize to `bool`\n- integer: `int` & `numpy.int` & `numpy.uint` -> deserialize to `int`\n- float: `float` & `numpy.float_` -> deserialize to `float`\n- decimal: `decimal.Decimal` -> deserialize to `decimal.Decimal`\n- string: `str` -> deserialize to `str`\n- bytes: `bytes` -> deserialize to `bytes`\n- date: `datetime.date` -> deserialize to `datetime.date`\n- time: `datetime.time` -> deserialize to `datetime.time`\n- datetime: `datetime.datetime` & `pandas.Timestamp` -> deserialize to `datetime.datetime`\n- datetime64*: `numpy.datetime64` & `time.struct_time` -> deserialize to `datetime.datetime`\n- timedelta: `datetime.timedelta` & `pandas.Timedelta` -> deserialize to `datetime.timedelta`\n- timedelta64: `numpy.timedelta64` -> deserialize to `datetime.timedelta`\n- None: `None` & `numpy.nan` -> deserialize to `None`\n- list: `list` of above supported data types -> deserialize to `list`\n- tuple: `tuple` of above supported data types -> deserialize to `list`\n- set: `set` of above supported data types -> deserialize to `list`\n- frozenset: `frozenset` of above supported data types -> deserialize to `list`\n- dict: `dict` of above supported data types -> deserialize to `dict`\n- numpy.record: `numpy.record` of above supported data types -> deserialize to `list`\n- numpy.ndarray: `numpy.ndarray` of above supported data types -> deserialize to `np.ndarray`\n- pandas.Series: `pandas.Series` of above supported data types -> deserialize to `pandas.Series`\n- pandas.DataFrame: `pandas.DataFrame` of above supported data types -> deserialize to `pandas.DataFrame`\n\n### Installation\nInstall from `PyPi`\n``` bash\npip install redisdecor\n```\n\nInstall from `github`\n``` bash\npip install git+https://github.com/AresJef/RedisDecor.git\n```\n\n### Compatibility\nOnly support for python 3.10 and above.\n\n### Usage (Setup)\n``` python\nimport redisdecor as rd\nimport datetime, numpy as np, pandas as pd\n# Decorators in this package relies on `Redis`, which is a\n# subclass of `redis.StrictRedis`. Besides the arguments\n# `decode_responses` is fixed to False, this subclass works\n# the same as `redis.StrictRedis`.\ncl = rd.get_client(host=\"127.0.0.1\", db=10)\n\n# A shared 'expensive' function for all three decorators\ndef gen_data(rows: int, offset: int = 0) -> pd.DataFrame:\n    # Add some delay to simulate expensiveness\n    time.sleep(1)\n    # Generate a pandas DataFrame\n    tz = datetime.timezone(datetime.timedelta(hours=8), \"CUS\")\n    dt = datetime.datetime.now()\n    dt = datetime.datetime(2023, 1, 1, 1, 1, 1, 1)\n    val = {\n        \"bool\": True,\n        \"np_bool\": np.bool_(False),\n        \"int\": 1 + offset,\n        \"int64\": np.int64(5 + offset),\n        \"unit\": np.uint(5 + offset),\n        \"unit64\": np.uint64(5 + offset),\n        \"float\": 1.1 + offset,\n        \"float64\": np.float64(4.4 + offset),\n        \"decimal\": Decimal(\"3.3\"),\n        \"str\": \"STRING\",\n        \"bytes\": b\"BYTES\",\n        \"datetime\": dt + datetime.timedelta(offset),\n        \"datetime_tz\": (dt + datetime.timedelta(offset)).replace(tzinfo=tz),\n        \"time\": (dt + datetime.timedelta(hours=offset)).time(),\n        \"time_tz\": (dt + datetime.timedelta(hours=offset)).time().replace(tzinfo=tz),\n        \"timedelta\": datetime.timedelta(1 + offset),\n        \"None\": None,\n    }\n    return pd.DataFrame([val for _ in range(rows)])\n\n# Shared prefix for all three decorators\nprefix = \"test\"\n\n# @cache decorator - returns function value\n@rd.cache(cl, prefix, 60)\ndef gen_data_cache(rows: int) -> pd.DataFrame:\n    return gen_data(rows, 0)\n\n# @update decorator - return bool | None\n@rd.update(cl, prefix)\ndef gen_data_update(rows: int) -> bool | None:\n    return gen_data(rows, 1)\n\n# @delete decorator return bool | None\n@rd.delete(cl, prefix) \ndef gen_data_delete(rows: int) -> bool | None:\n    return gen_data(rows, 0)\n```\n\n### Usage (Cache)\n``` python\nfrom timeit import timeit\n\n# Flush keys\ncl.flushall()\n\n# First call - (no cache) - corresponding key: \"test:100::\"\nprint(\"No. cache - 100 row\".ljust(20), timeit(lambda: gen_data_cache(100), number=1))\n# No. cache - 100 row  1.0088350829901174\n\n# Second call - (cache hit) - corresponding key: \"test:100::\"\nprint(\"Hit cache - 100 row\".ljust(20), timeit(lambda: gen_data_cache(100), number=1))\n# Hit cache - 100 row  0.002061583974864334\n\n# Call with different arguments - (no cache) - corresponding key: \"test:90::\"\nprint(\"No. cache - 90 row\".ljust(20), timeit(lambda: gen_data_cache(90), number=1))\n# No. cache - 90 row   1.0119208749965765\n\n# Second call - (cache hit) - corresponding key: \"test:90::\"\nprint(\"Hit cache - 90 row\".ljust(20), timeit(lambda: gen_data_cache(90), number=1))\n# Hit cache - 90 row   0.001857625029515475\n\n# Data\nprint(gen_data_cache(100))\n# <pandas.DataFrame>\n# bool np_bool int int64\u00a0unit unit64 float ... bytes datetime datetime_tz time time_tz timedelta\u00a0None\n# 0 True False\u00a01\u00a05\u00a05\u00a05\u00a01.1 ...\u00a02023-01-01 01:01:01.000001 2023-01-01 01:01:01.000001+08:00 01:01:01.000001 01:01:01.000001+08:00 1 days None\n# 1 True False\u00a01\u00a05\u00a05\u00a05\u00a01.1 ...\u00a02023-01-01 01:01:01.000001 2023-01-01 01:01:01.000001+08:00 01:01:01.000001 01:01:01.000001+08:00 1 days None\n# 2 True False\u00a01\u00a05\u00a05\u00a05\u00a01.1 ...\u00a02023-01-01 01:01:01.000001 2023-01-01 01:01:01.000001+08:00 01:01:01.000001 01:01:01.000001+08:00 1 days None\n# 3 True False\u00a01\u00a05\u00a05\u00a05\u00a01.1 ...\u00a02023-01-01 01:01:01.000001 2023-01-01 01:01:01.000001+08:00 01:01:01.000001 01:01:01.000001+08:00 1 days None\n# 4 True False\u00a01\u00a05\u00a05\u00a05\u00a01.1 ...\u00a02023-01-01 01:01:01.000001 2023-01-01 01:01:01.000001+08:00 01:01:01.000001 01:01:01.000001+08:00 1 days None\n# .. ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...\n# 95 True False\u00a01\u00a05\u00a05\u00a05\u00a01.1 ...\u00a02023-01-01 01:01:01.000001 2023-01-01 01:01:01.000001+08:00 01:01:01.000001 01:01:01.000001+08:00 1 days None\n# 96 True False\u00a01\u00a05\u00a05\u00a05\u00a01.1 ...\u00a02023-01-01 01:01:01.000001 2023-01-01 01:01:01.000001+08:00 01:01:01.000001 01:01:01.000001+08:00 1 days None\n# 97 True False\u00a01\u00a05\u00a05\u00a05\u00a01.1 ...\u00a02023-01-01 01:01:01.000001 2023-01-01 01:01:01.000001+08:00 01:01:01.000001 01:01:01.000001+08:00 1 days None\n# 98 True False\u00a01\u00a05\u00a05\u00a05\u00a01.1 ...\u00a02023-01-01 01:01:01.000001 2023-01-01 01:01:01.000001+08:00 01:01:01.000001 01:01:01.000001+08:00 1 days None\n# 99 True False\u00a01\u00a05\u00a05\u00a05\u00a01.1 ...\u00a02023-01-01 01:01:01.000001 2023-01-01 01:01:01.000001+08:00 01:01:01.000001 01:01:01.000001+08:00 1 days None\n# [100 rows x 17 columns]\n```\n\n### Usage (Update)\n``` python\n# Update existing cache - corresponding key: \"test:100::\"\nprint(\"Update cache - 100 row\".ljust(20), timeit(lambda: gen_data_update(100), number=1))\n# Update cache - 100 row 1.0083019589656033\nprint(\"Update status:\", gen_data_update(100)) # Will return True since the key exists.\n# Update status: True\n\n# Update non-exist cache - corresponding key: \"test:80::\"\nprint(\"Update miss - 80 row\".ljust(20), timeit(lambda: gen_data_update(80), number=1))\n# Update miss - 80 row   0.00012520799646154046\nprint(\"Update status:\", gen_data_update(80)) # Will return False since the key does not exist.\n# Update status: False\n\n# Data\nprint(gen_data_cache(100)) # Call cache function to retrieve the updated data\n# <pandas.DataFrame>\n# bool np_bool int int64\u00a0unit unit64 float ... bytes datetime datetime_tz time time_tz timedelta\u00a0None\n# 0 True False\u00a02\u00a06\u00a06\u00a06\u00a02.1 ...\u00a02023-01-02 01:01:01.000001 2023-01-02 01:01:01.000001+08:00 02:01:01.000001 02:01:01.000001+08:00 2 days None\n# 1 True False\u00a02\u00a06\u00a06\u00a06\u00a02.1 ...\u00a02023-01-02 01:01:01.000001 2023-01-02 01:01:01.000001+08:00 02:01:01.000001 02:01:01.000001+08:00 2 days None\n# 2 True False\u00a02\u00a06\u00a06\u00a06\u00a02.1 ...\u00a02023-01-02 01:01:01.000001 2023-01-02 01:01:01.000001+08:00 02:01:01.000001 02:01:01.000001+08:00 2 days None\n# 3 True False\u00a02\u00a06\u00a06\u00a06\u00a02.1 ...\u00a02023-01-02 01:01:01.000001 2023-01-02 01:01:01.000001+08:00 02:01:01.000001 02:01:01.000001+08:00 2 days None\n# 4 True False\u00a02\u00a06\u00a06\u00a06\u00a02.1 ...\u00a02023-01-02 01:01:01.000001 2023-01-02 01:01:01.000001+08:00 02:01:01.000001 02:01:01.000001+08:00 2 days None\n# .. ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...\n# 95 True False\u00a02\u00a06\u00a06\u00a06\u00a02.1 ...\u00a02023-01-02 01:01:01.000001 2023-01-02 01:01:01.000001+08:00 02:01:01.000001 02:01:01.000001+08:00 2 days None\n# 96 True False\u00a02\u00a06\u00a06\u00a06\u00a02.1 ...\u00a02023-01-02 01:01:01.000001 2023-01-02 01:01:01.000001+08:00 02:01:01.000001 02:01:01.000001+08:00 2 days None\n# 97 True False\u00a02\u00a06\u00a06\u00a06\u00a02.1 ...\u00a02023-01-02 01:01:01.000001 2023-01-02 01:01:01.000001+08:00 02:01:01.000001 02:01:01.000001+08:00 2 days None\n# 98 True False\u00a02\u00a06\u00a06\u00a06\u00a02.1 ...\u00a02023-01-02 01:01:01.000001 2023-01-02 01:01:01.000001+08:00 02:01:01.000001 02:01:01.000001+08:00 2 days None\n# 99 True False\u00a02\u00a06\u00a06\u00a06\u00a02.1 ...\u00a02023-01-02 01:01:01.000001 2023-01-02 01:01:01.000001+08:00 02:01:01.000001 02:01:01.000001+08:00 2 days None\n# [100 rows x 17 columns]\n```\n\n### Usage (Delete)\n``` python\n# Delete existing cache - corresponding key: \"test:100::\"\nprint(\"Delete cache - 100 row\".ljust(20), timeit(lambda: gen_date_delete(100), number=1))\n# Delete cache - 100 row 0.00010604201816022396\nprint(\"Delete status:\", gen_date_delete(100)) # Will return True since the key exists.\n# Delete status: True\n\n# Delete non-exist cache - corresponding key: \"test:80::\"\nprint(\"Delete miss - 80 row\".ljust(20), timeit(lambda: gen_date_delete(80), number=1))\n# Delete miss - 80 row   9.779195534065366e-05\nprint(\"Delete status:\", gen_date_delete(80)) # Will return False since the key does not exist.\n# Delete status: False\n\n# Check cache - corresponding key: \"test:80::\"\nprint(\"Check key:\", cl.get(\"test:100::\"))\n# Check key: None\n```\n\n### Acknowledgements\nredisdecor is based on several open-source repositories.\n- [hiredis](https://github.com/redis/hiredis-py)\n- [redis](https://github.com/redis/redis)\n- [serializor](https://github.com/AresJef/Serializor)\n\n",
    "bugtrack_url": null,
    "license": "MIT license, BSD 3-Clause",
    "summary": "Provides decorators to cache/update/delete results to/from Redis.",
    "version": "0.1.12.7",
    "project_urls": {
        "Homepage": "https://github.com/AresJef/RedisDecor"
    },
    "split_keywords": [
        "redis",
        "decorator",
        "cache",
        "update",
        "delete"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9c0b2827bd0d5aca22c9e0cb6b35018154e618613fdc61f7b2fb5d2f0b85e2ab",
                "md5": "519c5834d11c12080d3d7887d1271fd1",
                "sha256": "7b65c0f468814a92c86fb9ba2163549e6668b2a7e44f0d84fcedb1bfcc33fd9b"
            },
            "downloads": -1,
            "filename": "redisdecor-0.1.12.7-cp310-cp310-macosx_10_9_universal2.whl",
            "has_sig": false,
            "md5_digest": "519c5834d11c12080d3d7887d1271fd1",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.10",
            "size": 194505,
            "upload_time": "2023-11-08T04:24:54",
            "upload_time_iso_8601": "2023-11-08T04:24:54.549168Z",
            "url": "https://files.pythonhosted.org/packages/9c/0b/2827bd0d5aca22c9e0cb6b35018154e618613fdc61f7b2fb5d2f0b85e2ab/redisdecor-0.1.12.7-cp310-cp310-macosx_10_9_universal2.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3218dd607862c05df58cdccce229b318d5b9c5f33a3d544fa19ea3b4ab7cfa89",
                "md5": "74668aed190574699ac25f7f09e51721",
                "sha256": "ad80cd07ee25da4a767e23e22713ada85558e3a63ef1c04afe3162ebbd80d03b"
            },
            "downloads": -1,
            "filename": "redisdecor-0.1.12.7-cp310-cp310-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "74668aed190574699ac25f7f09e51721",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.10",
            "size": 153879,
            "upload_time": "2023-11-08T04:24:56",
            "upload_time_iso_8601": "2023-11-08T04:24:56.252147Z",
            "url": "https://files.pythonhosted.org/packages/32/18/dd607862c05df58cdccce229b318d5b9c5f33a3d544fa19ea3b4ab7cfa89/redisdecor-0.1.12.7-cp310-cp310-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "66c9c1470794e86f91176a043f1ebcf0b33be29579870663f5981841689df512",
                "md5": "50d371db177c2aa8bdf799a30496c041",
                "sha256": "8eaf30a32b15d45264c4944e42644baffd286cdea176a1cbb68b5ccee0a9fcdf"
            },
            "downloads": -1,
            "filename": "redisdecor-0.1.12.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "50d371db177c2aa8bdf799a30496c041",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.10",
            "size": 351808,
            "upload_time": "2023-11-08T04:24:58",
            "upload_time_iso_8601": "2023-11-08T04:24:58.199081Z",
            "url": "https://files.pythonhosted.org/packages/66/c9/c1470794e86f91176a043f1ebcf0b33be29579870663f5981841689df512/redisdecor-0.1.12.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4d799e4cb284b4753f4cb7d0a6d58bc52392abf14214d0597a17c501c08c7580",
                "md5": "35d7e55cbec19ac067c6fd607e6455e9",
                "sha256": "2c3297abaa8e32cab8ec069b76f881a6b34b6e450ba1fd8bd1d16abb3bc62211"
            },
            "downloads": -1,
            "filename": "redisdecor-0.1.12.7-cp310-cp310-musllinux_1_1_x86_64.whl",
            "has_sig": false,
            "md5_digest": "35d7e55cbec19ac067c6fd607e6455e9",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.10",
            "size": 358805,
            "upload_time": "2023-11-08T04:25:00",
            "upload_time_iso_8601": "2023-11-08T04:25:00.015249Z",
            "url": "https://files.pythonhosted.org/packages/4d/79/9e4cb284b4753f4cb7d0a6d58bc52392abf14214d0597a17c501c08c7580/redisdecor-0.1.12.7-cp310-cp310-musllinux_1_1_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "70dfac210bf9f0069c6c825c1f16f3d6affa206ff40e8f882badd7e31e3dfdef",
                "md5": "f84fa7d1f762d8b1d17e034a4cfe7742",
                "sha256": "0dc585907be3b1c4386084cf6ef05e3dfeb95c0da677c16a25d2cded39372979"
            },
            "downloads": -1,
            "filename": "redisdecor-0.1.12.7-cp310-cp310-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "f84fa7d1f762d8b1d17e034a4cfe7742",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.10",
            "size": 150104,
            "upload_time": "2023-11-08T04:25:01",
            "upload_time_iso_8601": "2023-11-08T04:25:01.880802Z",
            "url": "https://files.pythonhosted.org/packages/70/df/ac210bf9f0069c6c825c1f16f3d6affa206ff40e8f882badd7e31e3dfdef/redisdecor-0.1.12.7-cp310-cp310-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d122a42ad0f4ae320da55c18912c6a88afc25360de7f33dd10069f620d571465",
                "md5": "c900bd486218bca0374f2498086690c8",
                "sha256": "d93539bd5dba07747dd2247e79d46f4845de055de292e1bb8cde4afdbfc86d48"
            },
            "downloads": -1,
            "filename": "redisdecor-0.1.12.7-cp311-cp311-macosx_10_9_universal2.whl",
            "has_sig": false,
            "md5_digest": "c900bd486218bca0374f2498086690c8",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.10",
            "size": 194198,
            "upload_time": "2023-11-08T04:25:03",
            "upload_time_iso_8601": "2023-11-08T04:25:03.756176Z",
            "url": "https://files.pythonhosted.org/packages/d1/22/a42ad0f4ae320da55c18912c6a88afc25360de7f33dd10069f620d571465/redisdecor-0.1.12.7-cp311-cp311-macosx_10_9_universal2.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b2f7d4696416c125027c3a02ec00067bbb997bf85c7d1c5df7dda9cdf1c88cee",
                "md5": "8e055d1434e63b042bae09a1d8647eab",
                "sha256": "118f2d71e58084a67a9b4cfb0ecb8720cb52c4dd1da8f53f0cb8ae10c64c5bb3"
            },
            "downloads": -1,
            "filename": "redisdecor-0.1.12.7-cp311-cp311-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "8e055d1434e63b042bae09a1d8647eab",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.10",
            "size": 153733,
            "upload_time": "2023-11-08T04:25:05",
            "upload_time_iso_8601": "2023-11-08T04:25:05.443574Z",
            "url": "https://files.pythonhosted.org/packages/b2/f7/d4696416c125027c3a02ec00067bbb997bf85c7d1c5df7dda9cdf1c88cee/redisdecor-0.1.12.7-cp311-cp311-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5af92ef2235ed7671e425422c94e027834a3e0dc310be80d7fb61a33b449db9c",
                "md5": "e91c34b45291cd41533b70b35fdce33b",
                "sha256": "d5142731bd5eddf07b3f3ad09c21b0788b0601ef73ddc3643b48bba4e88ef9a5"
            },
            "downloads": -1,
            "filename": "redisdecor-0.1.12.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "e91c34b45291cd41533b70b35fdce33b",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.10",
            "size": 382745,
            "upload_time": "2023-11-08T04:25:07",
            "upload_time_iso_8601": "2023-11-08T04:25:07.215506Z",
            "url": "https://files.pythonhosted.org/packages/5a/f9/2ef2235ed7671e425422c94e027834a3e0dc310be80d7fb61a33b449db9c/redisdecor-0.1.12.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6e1d69421f4f9e735106ce5b9191422818a9dc2f967cae9f9659978c6c7a82dd",
                "md5": "a229730653ad77ab5a62d32584056b0b",
                "sha256": "125e17ac0e2441833e7795c76f9437555c3b6032478f966beea0134b62269473"
            },
            "downloads": -1,
            "filename": "redisdecor-0.1.12.7-cp311-cp311-musllinux_1_1_x86_64.whl",
            "has_sig": false,
            "md5_digest": "a229730653ad77ab5a62d32584056b0b",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.10",
            "size": 384342,
            "upload_time": "2023-11-08T04:25:08",
            "upload_time_iso_8601": "2023-11-08T04:25:08.794764Z",
            "url": "https://files.pythonhosted.org/packages/6e/1d/69421f4f9e735106ce5b9191422818a9dc2f967cae9f9659978c6c7a82dd/redisdecor-0.1.12.7-cp311-cp311-musllinux_1_1_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3997d1027c624fc6f06f420003237a1dbb86e4ba58036a83a1a0f669572a12ac",
                "md5": "c96c30f7a5458401c7147929b3715d30",
                "sha256": "e16e14ac233eae140adbeedcb3284a3476e52cd294cc51007cb36466b1b62b4f"
            },
            "downloads": -1,
            "filename": "redisdecor-0.1.12.7-cp311-cp311-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "c96c30f7a5458401c7147929b3715d30",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.10",
            "size": 149908,
            "upload_time": "2023-11-08T04:25:10",
            "upload_time_iso_8601": "2023-11-08T04:25:10.472648Z",
            "url": "https://files.pythonhosted.org/packages/39/97/d1027c624fc6f06f420003237a1dbb86e4ba58036a83a1a0f669572a12ac/redisdecor-0.1.12.7-cp311-cp311-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f2ae2d6a2743265768599510f2190cfcde52a31926993daba7e7e97f5f4050d4",
                "md5": "8468d5aa899165cc70a09a42146ece96",
                "sha256": "30a7ff6586e66b419011392b9e763bdc255364dc8af19d7ebb791c390380e9c2"
            },
            "downloads": -1,
            "filename": "redisdecor-0.1.12.7-cp312-cp312-macosx_10_9_universal2.whl",
            "has_sig": false,
            "md5_digest": "8468d5aa899165cc70a09a42146ece96",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.10",
            "size": 194779,
            "upload_time": "2023-11-08T04:25:11",
            "upload_time_iso_8601": "2023-11-08T04:25:11.636605Z",
            "url": "https://files.pythonhosted.org/packages/f2/ae/2d6a2743265768599510f2190cfcde52a31926993daba7e7e97f5f4050d4/redisdecor-0.1.12.7-cp312-cp312-macosx_10_9_universal2.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "881eb8b87a8214b5fb75d5c9e75885536d94d564884e60f5a473e4bde1ebca18",
                "md5": "2191ef714439b3ff2adb1e249da99a97",
                "sha256": "efa38a0b69d5ece388699ca6c6ebe1fa7ea9621f87b8bca927b076a32c3ad076"
            },
            "downloads": -1,
            "filename": "redisdecor-0.1.12.7-cp312-cp312-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "2191ef714439b3ff2adb1e249da99a97",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.10",
            "size": 154115,
            "upload_time": "2023-11-08T04:25:13",
            "upload_time_iso_8601": "2023-11-08T04:25:13.643049Z",
            "url": "https://files.pythonhosted.org/packages/88/1e/b8b87a8214b5fb75d5c9e75885536d94d564884e60f5a473e4bde1ebca18/redisdecor-0.1.12.7-cp312-cp312-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ad8cbf823c434282103f1a6be37ce0c83ab44884ce681e174000581116fc8028",
                "md5": "2c27839a89d4026682dad4830c9e8706",
                "sha256": "03bb7366ec866e00bf8c8b870b18811840e1d5c66e43027218110e37c6a26565"
            },
            "downloads": -1,
            "filename": "redisdecor-0.1.12.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "2c27839a89d4026682dad4830c9e8706",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.10",
            "size": 398359,
            "upload_time": "2023-11-08T04:25:15",
            "upload_time_iso_8601": "2023-11-08T04:25:15.665746Z",
            "url": "https://files.pythonhosted.org/packages/ad/8c/bf823c434282103f1a6be37ce0c83ab44884ce681e174000581116fc8028/redisdecor-0.1.12.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5aca699f9ef45d846536968bd4d95617a71894f5c2db35a30923c01b393b2a71",
                "md5": "7cb86e2ce84f7d965c9ad2a3762a54a2",
                "sha256": "bb9ad420c459597bb061e7be5f8c0ea02548ee98e0d9a0c8453ecd5551af9479"
            },
            "downloads": -1,
            "filename": "redisdecor-0.1.12.7-cp312-cp312-musllinux_1_1_x86_64.whl",
            "has_sig": false,
            "md5_digest": "7cb86e2ce84f7d965c9ad2a3762a54a2",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.10",
            "size": 397876,
            "upload_time": "2023-11-08T04:25:17",
            "upload_time_iso_8601": "2023-11-08T04:25:17.205298Z",
            "url": "https://files.pythonhosted.org/packages/5a/ca/699f9ef45d846536968bd4d95617a71894f5c2db35a30923c01b393b2a71/redisdecor-0.1.12.7-cp312-cp312-musllinux_1_1_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e35100820d0854c636c0632e0011d8532cefb1ae0798fc627255bf845c7ee678",
                "md5": "2c021b37aee9048893a21f6c4cad4c49",
                "sha256": "fa4e8896d49b0e6f5157a63053a92a22ae52b3561b4abb3c95cb0f63d0b3570f"
            },
            "downloads": -1,
            "filename": "redisdecor-0.1.12.7-cp312-cp312-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "2c021b37aee9048893a21f6c4cad4c49",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.10",
            "size": 149953,
            "upload_time": "2023-11-08T04:25:18",
            "upload_time_iso_8601": "2023-11-08T04:25:18.616886Z",
            "url": "https://files.pythonhosted.org/packages/e3/51/00820d0854c636c0632e0011d8532cefb1ae0798fc627255bf845c7ee678/redisdecor-0.1.12.7-cp312-cp312-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4bf9cfaba547cd4d2de448cb594433bb4eba2039cc4688c4d93292ee07e04c19",
                "md5": "cda6684fe7e8752a9a0a9091a27d7d3f",
                "sha256": "f205abdc3ff17f341d912ed033c121d70eb2bc5989ae57d8c411ad05aa4f6d0f"
            },
            "downloads": -1,
            "filename": "redisdecor-0.1.12.7.tar.gz",
            "has_sig": false,
            "md5_digest": "cda6684fe7e8752a9a0a9091a27d7d3f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 109793,
            "upload_time": "2023-11-08T04:25:20",
            "upload_time_iso_8601": "2023-11-08T04:25:20.277711Z",
            "url": "https://files.pythonhosted.org/packages/4b/f9/cfaba547cd4d2de448cb594433bb4eba2039cc4688c4d93292ee07e04c19/redisdecor-0.1.12.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-08 04:25:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "AresJef",
    "github_project": "RedisDecor",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "redisdecor"
}
        
Elapsed time: 0.15114s