ddb-cache-0.6.0
0.6.0
0.5.9
0.5.8
0.5.7
0.5.6
0.5.5
0.5.40
0.5.4
0.5.39
0.5.38
0.5.37
0.5.36
0.5.35
0.5.34
0.5.33
0.5.32
0.5.31
0.5.30
0.5.3
0.5.29
0.5.28
0.5.27
0.5.26
0.5.25
0.5.24
0.5.23
0.5.22
0.5.21
0.5.20
0.5.2
0.5.19
0.5.18
0.5.17
0.5.16
0.5.15
0.5.14
0.5.13
0.5.12
0.5.11
0.5.10
0.5.1
0.4.99
0.4.98
0.4.97
0.4.96
0.4.95
0.4.94
0.4.93
0.4.92
0.4.91
0.4.90
0.4.9
0.4.89
0.4.88
0.4.87
0.4.86
0.4.85
0.4.84
0.4.83
0.4.82
0.4.81
0.4.80
0.4.8
0.4.79
0.4.78
0.4.77
0.4.76
0.4.75
0.4.74
0.4.73
0.4.72
0.4.71
0.4.70
0.4.7
0.4.69
0.4.68
0.4.67
0.4.66
0.4.65
0.4.64
0.4.63
0.4.62
0.4.61
0.4.60
0.4.6
0.4.59
0.4.58
0.4.57
0.4.56
0.4.55
0.4.54
0.4.53
0.4.52
0.4.51
0.4.50
0.4.5
0.4.49
0.4.48
0.4.47
0.4.46
0.4.45
0.4.44
0.4.43
0.4.42
0.4.41
0.4.40
0.4.4
0.4.39
0.4.38
0.4.37
0.4.36
0.4.35
0.4.34
0.4.33
0.4.32
0.4.31
0.4.30
0.4.3
0.4.29
0.4.28
0.4.27
0.4.26
0.4.25
0.4.24
0.4.23
0.4.22
0.4.21
0.4.20
0.4.19
0.4.18
0.4.17
0.4.16
0.4.15
0.4.14
0.4.13
0.4.12
0.4.11
0.4.10
0.4.1
0.4.0
0.3.2
0.2.1
0.1.0
0.6.0
0.5.9
0.5.8
0.5.7
0.5.6
0.5.5
0.5.40
0.5.4
0.5.39
0.5.38
0.5.37
0.5.36
0.5.35
0.5.34
0.5.33
0.5.32
0.5.31
0.5.30
0.5.3
0.5.29
0.5.28
0.5.27
0.5.26
0.5.25
0.5.24
0.5.23
0.5.22
0.5.21
0.5.20
0.5.2
0.5.19
0.5.18
0.5.17
0.5.16
0.5.15
0.5.14
0.5.13
0.5.12
0.5.11
0.5.10
0.5.1
0.4.99
0.4.98
0.4.97
0.4.96
0.4.95
0.4.94
0.4.93
0.4.92
0.4.91
0.4.90
0.4.9
0.4.89
0.4.88
0.4.87
0.4.86
0.4.85
0.4.84
0.4.83
0.4.82
0.4.81
0.4.80
0.4.8
0.4.79
0.4.78
0.4.77
0.4.76
0.4.75
0.4.74
0.4.73
0.4.72
0.4.71
0.4.70
0.4.7
0.4.69
0.4.68
0.4.67
0.4.66
0.4.65
0.4.64
0.4.63
0.4.62
0.4.61
0.4.60
0.4.6
0.4.59
0.4.58
0.4.57
0.4.56
0.4.55
0.4.54
0.4.53
0.4.52
0.4.51
0.4.50
0.4.5
0.4.49
0.4.48
0.4.47
0.4.46
0.4.45
0.4.44
0.4.43
0.4.42
0.4.41
0.4.40
0.4.4
0.4.39
0.4.38
0.4.37
0.4.36
0.4.35
0.4.34
0.4.33
0.4.32
0.4.31
0.4.30
0.4.3
0.4.29
0.4.28
0.4.27
0.4.26
0.4.25
0.4.24
0.4.23
0.4.22
0.4.21
0.4.20
0.4.19
0.4.18
0.4.17
0.4.16
0.4.15
0.4.14
0.4.13
0.4.12
0.4.11
0.4.10
0.4.1
0.4.0
0.3.2
0.2.1
0.1.0
توضیحات
A simple interface for caching items in DynamoDB
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | ddb-cache-0.6.0 |
| نام | ddb-cache |
| نسخه کتابخانه | 0.6.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | - |
| ایمیل نویسنده | Sam <dev@samarthj.com> |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/ddb-cache/ |
| مجوز | LGPL-3.0-or-later |
# ddb-cache
A simple interface for caching items in DynamoDB

[](https://github.com/samarthj/py-ddbcache/actions/workflows/release.yml)
[](https://github.com/samarthj/py-ddbcache/releases)
[](https://pypi.org/project/ddb-cache/)
[](https://github.com/samarthj/py-ddbcache/actions/workflows/build_matrix.yml)
[](https://codecov.io/gh/samarthj/py-ddbcache)
[](https://lgtm.com/projects/g/samarthj/py-ddbcache/alerts/)
[](https://lgtm.com/projects/g/samarthj/py-ddbcache/context:python)
[](https://pdm.fming.dev)
[](https://conventionalcommits.org)
## Example Usage
Samples can be found here in the [tests](https://github.com/samarthj/py-ddbcache/blob/main/tests/test_ddbcache.py)
The library can also be used for crud operations since it implement `get`, `put`, `update`, `delete`, `scan` and `query`. Along with `create_backup`.
Basic usage is as given below:
```python
def test_put_cache(ddb_cache: DDBCache):
data = randint(1, 100) # noqa: S311
ddb_cache.put_cache({"id": "test_put_cache", "data": data})
item = ddb_cache.get_item({"id": "test_put_cache"})
assert item
assert item["id"] == "test_put_cache"
assert item["data"] == data
assert item["ttl"]
def test_put_cache_no_ttl(ddb_cache: DDBCache):
data = randint(1, 100) # noqa: S311
ddb_cache.put_cache({"id": "test_put_cache", "data": data}, with_ttl=False)
item = ddb_cache.get_item({"id": "test_put_cache"})
assert item
assert item["id"] == "test_put_cache"
assert item["data"] == data
with pytest.raises(KeyError):
item["ttl"]
def test_fetch_cache(ddb_cache: DDBCache, init_cache):
item = ddb_cache.get_item({"id": "test_fetch_cache"})
assert item
assert item["id"] == "test_fetch_cache"
assert item["data"] == "test_fetch_cache"
ttl = item["ttl"]
assert ttl
sleep(1)
item = ddb_cache.fetch_cache({"id": "test_fetch_cache"})
assert item
assert item["id"] == "test_fetch_cache"
assert item["data"] == "test_fetch_cache"
with pytest.raises(KeyError):
item["ttl"]
item = ddb_cache.get_item({"id": "test_fetch_cache"})
assert item
assert item["id"] == "test_fetch_cache"
assert item["data"] == "test_fetch_cache"
ttl2 = item["ttl"]
assert ttl2
assert ttl != ttl2
def test_fetch_cache_no_ttl_update(ddb_cache: DDBCache, init_cache):
item = ddb_cache.get_item({"id": "test_fetch_cache"})
assert item
assert item["id"] == "test_fetch_cache"
assert item["data"] == "test_fetch_cache"
ttl = item["ttl"]
assert ttl
item = ddb_cache.fetch_cache({"id": "test_fetch_cache"}, with_ttl=False)
assert item
assert item["id"] == "test_fetch_cache"
assert item["data"] == "test_fetch_cache"
with pytest.raises(KeyError):
item["ttl"]
item = ddb_cache.get_item({"id": "test_fetch_cache"})
assert item
assert item["id"] == "test_fetch_cache"
assert item["data"] == "test_fetch_cache"
ttl2 = item["ttl"]
assert ttl2
assert ttl == ttl2
```
نیازمندی
| مقدار | نام |
|---|---|
| ython_version>='3.9 | boto3; |
| ython_version>='3.9 | pylib-helpers; |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.9 | Python |
نحوه نصب
نصب پکیج whl ddb-cache-0.6.0:
pip install ddb-cache-0.6.0.whl
نصب پکیج tar.gz ddb-cache-0.6.0:
pip install ddb-cache-0.6.0.tar.gz