database-wrapper-redis 0.2.9__tar.gz → 0.2.12__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: database_wrapper_redis
3
- Version: 0.2.9
3
+ Version: 0.2.12
4
4
  Summary: database_wrapper for Redis database
5
5
  Author-email: Gints Murans <gm@gm.lv>
6
6
  License: GNU General Public License v3.0 (GPL-3.0)
@@ -32,7 +32,7 @@ Classifier: Topic :: Software Development
32
32
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
33
33
  Requires-Python: >=3.8
34
34
  Description-Content-Type: text/markdown
35
- Requires-Dist: database_wrapper==0.2.9
35
+ Requires-Dist: database_wrapper==0.2.12
36
36
  Requires-Dist: redis
37
37
 
38
38
  # database_wrapper_redis
@@ -11,6 +11,7 @@ import logging
11
11
  from .connector import (
12
12
  # Basics
13
13
  RedisConfig,
14
+ RedisDefaultConfig,
14
15
  # Connectors
15
16
  RedisDB,
16
17
  RedisDBAsync,
@@ -42,4 +43,5 @@ __all__ = [
42
43
  "RedisConnectionAsync",
43
44
  # Helpers
44
45
  "RedisConfig",
46
+ "RedisDefaultConfig",
45
47
  ]
@@ -130,7 +130,7 @@ class KVDbBase:
130
130
  timeout: int = 5,
131
131
  instance_name: str | None = None,
132
132
  ) -> None:
133
- self.config = self.fillConfig(config)
133
+ self.config = self.fill_config(config)
134
134
  self.timeout = timeout
135
135
 
136
136
  self.pool = None
@@ -190,7 +190,7 @@ class KVDbBase:
190
190
  ### Helpers ###
191
191
  ###############
192
192
 
193
- def fillConfig(self, config: RedisDefaultConfig) -> RedisConfig:
193
+ def fill_config(self, config: RedisDefaultConfig) -> RedisConfig:
194
194
  return RedisConfig(
195
195
  hostname=config["hostname"],
196
196
  port=int(config.get("port", 6379)),
@@ -302,6 +302,12 @@ class RedisDBAsync(KVDbBase):
302
302
 
303
303
  self.context_connection = ContextVar("RedisDBAsync", default=None)
304
304
 
305
+ def __del__(self) -> None:
306
+ self.logger.debug("Dealloc")
307
+
308
+ # Just to be sure as async does not have __del__
309
+ del self._connection
310
+
305
311
  async def new_connection(self) -> RedisClientAsync:
306
312
  tries = 0
307
313
  while self.wait_for_connection and not self.shutdown_requested.is_set():
@@ -375,9 +381,7 @@ class RedisDBWithPool(KVDbBase):
375
381
  super().__init__(config=config, timeout=timeout, instance_name=instance_name)
376
382
 
377
383
  self.pool = RedisConnectionPool(
378
- connection_class=(
379
- RedisSSLConnection if self.config["ssl"] else RedisConnection
380
- ),
384
+ connection_class=(RedisSSLConnection if self.config["ssl"] else RedisConnection),
381
385
  max_connections=self.config["maxconnections"],
382
386
  host=self.config["hostname"],
383
387
  port=self.config["port"],
@@ -448,9 +452,7 @@ class RedisDBWithPoolAsync(KVDbBase):
448
452
  super().__init__(config=config, timeout=timeout, instance_name=instance_name)
449
453
 
450
454
  self.pool = RedisConnectionPoolAsync(
451
- connection_class=(
452
- RedisSSLConnectionAsync if self.config["ssl"] else RedisConnectionAsync
453
- ),
455
+ connection_class=(RedisSSLConnectionAsync if self.config["ssl"] else RedisConnectionAsync),
454
456
  max_connections=self.config["maxconnections"],
455
457
  host=self.config["hostname"],
456
458
  port=self.config["port"],
@@ -467,6 +469,13 @@ class RedisDBWithPoolAsync(KVDbBase):
467
469
 
468
470
  self.context_connection = ContextVar("RedisDBWithPoolAsync", default=None)
469
471
 
472
+ def __del__(self) -> None:
473
+ self.logger.debug("Dealloc")
474
+
475
+ # Just to be sure as async does not have __del__
476
+ del self._connection
477
+ del self.pool
478
+
470
479
  async def new_connection(self) -> RedisClientAsync:
471
480
  tries = 0
472
481
  while self.wait_for_connection and not self.shutdown_requested.is_set():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: database_wrapper_redis
3
- Version: 0.2.9
3
+ Version: 0.2.12
4
4
  Summary: database_wrapper for Redis database
5
5
  Author-email: Gints Murans <gm@gm.lv>
6
6
  License: GNU General Public License v3.0 (GPL-3.0)
@@ -32,7 +32,7 @@ Classifier: Topic :: Software Development
32
32
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
33
33
  Requires-Python: >=3.8
34
34
  Description-Content-Type: text/markdown
35
- Requires-Dist: database_wrapper==0.2.9
35
+ Requires-Dist: database_wrapper==0.2.12
36
36
  Requires-Dist: redis
37
37
 
38
38
  # database_wrapper_redis
@@ -0,0 +1,2 @@
1
+ database_wrapper==0.2.12
2
+ redis
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "database_wrapper_redis"
7
- version = "0.2.9"
7
+ version = "0.2.12"
8
8
  description = "database_wrapper for Redis database"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -35,7 +35,7 @@ classifiers = [
35
35
  ]
36
36
  keywords = ["database", "wrapper", "python", "redis"]
37
37
  dependencies = [
38
- "database_wrapper == 0.2.9",
38
+ "database_wrapper == 0.2.12",
39
39
  "redis",
40
40
  ]
41
41
 
@@ -1,2 +0,0 @@
1
- database_wrapper==0.2.9
2
- redis