smart-redis-storage 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2024, A.A Suvorov
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,66 @@
1
+ Metadata-Version: 2.1
2
+ Name: smart-redis-storage
3
+ Version: 0.0.1
4
+ Summary: Convenient work with Redis.
5
+ Home-page: https://github.com/smartlegionlab/smart_redis_storage/
6
+ Author: A.A Suvorov
7
+ Author-email: smartlegiondev@gmail.com
8
+ License: BSD 3-Clause License
9
+ Project-URL: Documentation, https://github.com/smartlegionlab/smart_redis_storage/blob/master/README.md
10
+ Project-URL: Release notes, https://github.com/smartlegionlab/smart_redis_storage/releases
11
+ Keywords: redis,django,smartlegionlab
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: License :: OSI Approved :: BSD License
14
+ Classifier: Natural Language :: English
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Requires-Python: >=3.6
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: redis~=5.0.4
23
+
24
+ # smart_redis_storage <sup>0.0.1</sup>
25
+ Convenient work with Redis.
26
+
27
+ ***
28
+
29
+ ![GitHub top language](https://img.shields.io/github/languages/top/smartlegionlab/smartredisstorage)
30
+ [![PyPI - Downloads](https://img.shields.io/pypi/dm/smartredisstorage?label=pypi%20downloads)](https://pypi.org/project/smartredisstorage/)
31
+ [![GitHub release (latest by date)](https://img.shields.io/github/v/release/smartlegionlab/smartredisstorage)](https://github.com/smartlegionlab/smartredisstorage/)
32
+ [![GitHub](https://img.shields.io/github/license/smartlegionlab/smartredisstorage)](https://github.com/smartlegionlab/smartredisstorage/blob/master/LICENSE)
33
+ [![PyPI](https://img.shields.io/pypi/v/smartredisstorage)](https://pypi.org/project/smartredisstorage)
34
+ [![PyPI - Format](https://img.shields.io/pypi/format/smartredisstorage)](https://pypi.org/project/smartredisstorage)
35
+ [![GitHub Repo stars](https://img.shields.io/github/stars/smartlegionlab/smartredisstorage?style=social)](https://github.com/smartlegionlab/smartredisstorage/)
36
+ [![GitHub watchers](https://img.shields.io/github/watchers/smartlegionlab/smartredisstorage?style=social)](https://github.com/smartlegionlab/smartredisstorage/)
37
+ [![GitHub forks](https://img.shields.io/github/forks/smartlegionlab/smartredisstorage?style=social)](https://github.com/smartlegionlab/smartredisstorage/)
38
+
39
+ ***
40
+
41
+ Author and developer: ___A.A Suvorov___
42
+
43
+ ***
44
+
45
+ ## Disclaimer of liability:
46
+
47
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
48
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
50
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
51
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
53
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
54
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
55
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
56
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
57
+
58
+ ***
59
+
60
+ ## Copyright:
61
+ --------------------------------------------------------
62
+ Licensed under the terms of the BSD 3-Clause License
63
+ (see LICENSE for details).
64
+ Copyright © 2018-2024, A.A Suvorov
65
+ All rights reserved.
66
+ --------------------------------------------------------
@@ -0,0 +1,43 @@
1
+ # smart_redis_storage <sup>0.0.1</sup>
2
+ Convenient work with Redis.
3
+
4
+ ***
5
+
6
+ ![GitHub top language](https://img.shields.io/github/languages/top/smartlegionlab/smartredisstorage)
7
+ [![PyPI - Downloads](https://img.shields.io/pypi/dm/smartredisstorage?label=pypi%20downloads)](https://pypi.org/project/smartredisstorage/)
8
+ [![GitHub release (latest by date)](https://img.shields.io/github/v/release/smartlegionlab/smartredisstorage)](https://github.com/smartlegionlab/smartredisstorage/)
9
+ [![GitHub](https://img.shields.io/github/license/smartlegionlab/smartredisstorage)](https://github.com/smartlegionlab/smartredisstorage/blob/master/LICENSE)
10
+ [![PyPI](https://img.shields.io/pypi/v/smartredisstorage)](https://pypi.org/project/smartredisstorage)
11
+ [![PyPI - Format](https://img.shields.io/pypi/format/smartredisstorage)](https://pypi.org/project/smartredisstorage)
12
+ [![GitHub Repo stars](https://img.shields.io/github/stars/smartlegionlab/smartredisstorage?style=social)](https://github.com/smartlegionlab/smartredisstorage/)
13
+ [![GitHub watchers](https://img.shields.io/github/watchers/smartlegionlab/smartredisstorage?style=social)](https://github.com/smartlegionlab/smartredisstorage/)
14
+ [![GitHub forks](https://img.shields.io/github/forks/smartlegionlab/smartredisstorage?style=social)](https://github.com/smartlegionlab/smartredisstorage/)
15
+
16
+ ***
17
+
18
+ Author and developer: ___A.A Suvorov___
19
+
20
+ ***
21
+
22
+ ## Disclaimer of liability:
23
+
24
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+
35
+ ***
36
+
37
+ ## Copyright:
38
+ --------------------------------------------------------
39
+ Licensed under the terms of the BSD 3-Clause License
40
+ (see LICENSE for details).
41
+ Copyright © 2018-2024, A.A Suvorov
42
+ All rights reserved.
43
+ --------------------------------------------------------
@@ -0,0 +1,39 @@
1
+ [metadata]
2
+ name = smart-redis-storage
3
+ version = 0.0.1
4
+ author = A.A Suvorov
5
+ author_email = smartlegiondev@gmail.com
6
+ description = Convenient work with Redis.
7
+ long_description = file: README.md
8
+ long_description_content_type = text/markdown
9
+ url = https://github.com/smartlegionlab/smart_redis_storage/
10
+ project_urls =
11
+ Documentation = https://github.com/smartlegionlab/smart_redis_storage/blob/master/README.md
12
+ Release notes = https://github.com/smartlegionlab/smart_redis_storage/releases
13
+ license = BSD 3-Clause License
14
+ classifiers =
15
+ Development Status :: 5 - Production/Stable
16
+ License :: OSI Approved :: BSD License
17
+ Natural Language :: English
18
+ Operating System :: OS Independent
19
+ Operating System :: POSIX :: Linux
20
+ Programming Language :: Python :: 3 :: Only
21
+ Topic :: Software Development :: Libraries :: Python Modules
22
+ keywords =
23
+ redis
24
+ django
25
+ smartlegionlab
26
+
27
+ [options]
28
+ package_dir =
29
+ packages = find:
30
+ python_requires = >= 3.6
31
+ include_package_data = true
32
+ zip_safe = false
33
+ install_requires =
34
+ redis~=5.0.4
35
+
36
+ [egg_info]
37
+ tag_build =
38
+ tag_date = 0
39
+
@@ -0,0 +1,13 @@
1
+ # --------------------------------------------------------
2
+ # Licensed under the terms of the BSD 3-Clause License
3
+ # (see LICENSE for details).
4
+ # Copyright © 2018-2024, A.A Suvorov
5
+ # All rights reserved.
6
+ # --------------------------------------------------------
7
+ # https://github.com/smartlegionlab
8
+ # --------------------------------------------------------
9
+ from setuptools import setup, find_packages
10
+
11
+ setup(
12
+ packages=find_packages(exclude=("tests", "data", "requirements")),
13
+ )
@@ -0,0 +1,8 @@
1
+ # --------------------------------------------------------
2
+ # Licensed under the terms of the BSD 3-Clause License
3
+ # (see LICENSE for details).
4
+ # Copyright © 2018-2024, A.A Suvorov
5
+ # All rights reserved.
6
+ # --------------------------------------------------------
7
+ # https://github.com/smartlegionlab
8
+ # --------------------------------------------------------
@@ -0,0 +1,45 @@
1
+ # --------------------------------------------------------
2
+ # Licensed under the terms of the BSD 3-Clause License
3
+ # (see LICENSE for details).
4
+ # Copyright © 2018-2024, A.A Suvorov
5
+ # All rights reserved.
6
+ # --------------------------------------------------------
7
+ # https://github.com/smartlegionlab
8
+ # --------------------------------------------------------
9
+ import redis
10
+ import json
11
+
12
+
13
+ class UserRedisStorage:
14
+ def __init__(self, host='localhost', port=6379, db=0):
15
+ self.r = redis.Redis(host=host, port=port, db=db)
16
+
17
+ def set_data(self, user_id, key, value, expiration=None):
18
+ user_key = f"user:{user_id}"
19
+ self.r.hset(user_key, key, json.dumps(value))
20
+ if expiration is not None:
21
+ self.r.expire(user_key, expiration)
22
+
23
+ def get_data(self, user_id, key, pop=False):
24
+ user_key = f"user:{user_id}"
25
+ data = self.r.hget(user_key, key)
26
+ if pop and data is not None:
27
+ self.r.hdel(user_key, key)
28
+ return json.loads(data) if data else None
29
+
30
+ def get_all_data(self, user_id):
31
+ user_key = f"user:{user_id}"
32
+ data = self.r.hgetall(user_key)
33
+ decoded_data = {key.decode(): json.loads(value) for key, value in data.items()}
34
+ return decoded_data
35
+
36
+ def delete_data(self, user_id, key):
37
+ user_key = f"user:{user_id}"
38
+ self.r.hdel(user_key, key)
39
+
40
+ def delete_all_data(self, user_id):
41
+ user_key = f"user:{user_id}"
42
+ self.r.delete(user_key)
43
+
44
+ def pop_data(self, user_id, key):
45
+ return self.get_data(user_id, key, pop=True)
@@ -0,0 +1,66 @@
1
+ Metadata-Version: 2.1
2
+ Name: smart-redis-storage
3
+ Version: 0.0.1
4
+ Summary: Convenient work with Redis.
5
+ Home-page: https://github.com/smartlegionlab/smart_redis_storage/
6
+ Author: A.A Suvorov
7
+ Author-email: smartlegiondev@gmail.com
8
+ License: BSD 3-Clause License
9
+ Project-URL: Documentation, https://github.com/smartlegionlab/smart_redis_storage/blob/master/README.md
10
+ Project-URL: Release notes, https://github.com/smartlegionlab/smart_redis_storage/releases
11
+ Keywords: redis,django,smartlegionlab
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: License :: OSI Approved :: BSD License
14
+ Classifier: Natural Language :: English
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Requires-Python: >=3.6
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: redis~=5.0.4
23
+
24
+ # smart_redis_storage <sup>0.0.1</sup>
25
+ Convenient work with Redis.
26
+
27
+ ***
28
+
29
+ ![GitHub top language](https://img.shields.io/github/languages/top/smartlegionlab/smartredisstorage)
30
+ [![PyPI - Downloads](https://img.shields.io/pypi/dm/smartredisstorage?label=pypi%20downloads)](https://pypi.org/project/smartredisstorage/)
31
+ [![GitHub release (latest by date)](https://img.shields.io/github/v/release/smartlegionlab/smartredisstorage)](https://github.com/smartlegionlab/smartredisstorage/)
32
+ [![GitHub](https://img.shields.io/github/license/smartlegionlab/smartredisstorage)](https://github.com/smartlegionlab/smartredisstorage/blob/master/LICENSE)
33
+ [![PyPI](https://img.shields.io/pypi/v/smartredisstorage)](https://pypi.org/project/smartredisstorage)
34
+ [![PyPI - Format](https://img.shields.io/pypi/format/smartredisstorage)](https://pypi.org/project/smartredisstorage)
35
+ [![GitHub Repo stars](https://img.shields.io/github/stars/smartlegionlab/smartredisstorage?style=social)](https://github.com/smartlegionlab/smartredisstorage/)
36
+ [![GitHub watchers](https://img.shields.io/github/watchers/smartlegionlab/smartredisstorage?style=social)](https://github.com/smartlegionlab/smartredisstorage/)
37
+ [![GitHub forks](https://img.shields.io/github/forks/smartlegionlab/smartredisstorage?style=social)](https://github.com/smartlegionlab/smartredisstorage/)
38
+
39
+ ***
40
+
41
+ Author and developer: ___A.A Suvorov___
42
+
43
+ ***
44
+
45
+ ## Disclaimer of liability:
46
+
47
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
48
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
50
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
51
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
53
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
54
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
55
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
56
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
57
+
58
+ ***
59
+
60
+ ## Copyright:
61
+ --------------------------------------------------------
62
+ Licensed under the terms of the BSD 3-Clause License
63
+ (see LICENSE for details).
64
+ Copyright © 2018-2024, A.A Suvorov
65
+ All rights reserved.
66
+ --------------------------------------------------------
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+ README.md
3
+ setup.cfg
4
+ setup.py
5
+ smart_redis_storage/__init__.py
6
+ smart_redis_storage/redis_storage.py
7
+ smart_redis_storage.egg-info/PKG-INFO
8
+ smart_redis_storage.egg-info/SOURCES.txt
9
+ smart_redis_storage.egg-info/dependency_links.txt
10
+ smart_redis_storage.egg-info/not-zip-safe
11
+ smart_redis_storage.egg-info/requires.txt
12
+ smart_redis_storage.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ smart_redis_storage