collections-cache 0.2.4.20250303__py3-none-any.whl → 0.2.6.20250303__py3-none-any.whl
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.
- collections_cache/collections_cache.py +8 -1
- {collections_cache-0.2.4.20250303.dist-info → collections_cache-0.2.6.20250303.dist-info}/METADATA +1 -1
- collections_cache-0.2.6.20250303.dist-info/RECORD +6 -0
- collections_cache-0.2.4.20250303.dist-info/RECORD +0 -6
- {collections_cache-0.2.4.20250303.dist-info → collections_cache-0.2.6.20250303.dist-info}/LICENSE +0 -0
- {collections_cache-0.2.4.20250303.dist-info → collections_cache-0.2.6.20250303.dist-info}/WHEEL +0 -0
@@ -5,6 +5,7 @@ from itertools import chain
|
|
5
5
|
from os import cpu_count, path, makedirs, scandir
|
6
6
|
from concurrent.futures import ProcessPoolExecutor as Pool
|
7
7
|
from concurrent.futures import ThreadPoolExecutor as Thread
|
8
|
+
from threading import Thread as Thread_Exec
|
8
9
|
|
9
10
|
class Collection_Cache:
|
10
11
|
def __init__(self, collection_name):
|
@@ -66,6 +67,12 @@ class Collection_Cache:
|
|
66
67
|
return keys
|
67
68
|
|
68
69
|
def set_key(self, key: str, value: any):
|
70
|
+
"""Used to store values and associate a value with a key."""
|
71
|
+
t = Thread_Exec(target=self.set_key_exec, args=(key, value))
|
72
|
+
t.start()
|
73
|
+
t.join()
|
74
|
+
|
75
|
+
def set_key_exec(self, key: str, value: any):
|
69
76
|
"""Used to store values and associate a value with a key."""
|
70
77
|
if key not in self.keys_databases:
|
71
78
|
database_to_insert = choice(self.databases_list)
|
@@ -90,7 +97,7 @@ class Collection_Cache:
|
|
90
97
|
"""Experimental. Set multiple keys and values at the same time."""
|
91
98
|
|
92
99
|
with Thread(self.cpu_cores) as thread:
|
93
|
-
thread.map(lambda kv: self.
|
100
|
+
thread.map(lambda kv: self.set_key_exec(kv[0], kv[1]), keys_and_values.items())
|
94
101
|
|
95
102
|
def add_to_keys_database(self, key, database):
|
96
103
|
self.keys_databases[key] = database
|
{collections_cache-0.2.4.20250303.dist-info → collections_cache-0.2.6.20250303.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: collections-cache
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.6.20250303
|
4
4
|
Summary: collections-cache is a Python package for managing data collections across multiple SQLite databases. It allows efficient storage, retrieval, and updating of key-value pairs, supporting various data types serialized with pickle. The package uses parallel processing for fast access and manipulation of large collections.
|
5
5
|
License: MIT
|
6
6
|
Author: Luiz-Trindade
|
@@ -0,0 +1,6 @@
|
|
1
|
+
collections_cache/__init__.py,sha256=uUp8lhp-HnZRumnU_8MT6qVq95t0pOzn7oLW7ARbnvc,48
|
2
|
+
collections_cache/collections_cache.py,sha256=pcw-JhqY8KpYpZ6RzR_AXNYoCg5aYM8QCtBy4tcWnv0,5382
|
3
|
+
collections_cache-0.2.6.20250303.dist-info/LICENSE,sha256=RAIL-FmXSiNRgyiVlfhm2SvVI4XDVsN0jDt9207SJ8o,1168
|
4
|
+
collections_cache-0.2.6.20250303.dist-info/METADATA,sha256=M1vAN00zGNQCNb-nV2bFR8COiHL2s9OKz6wejMF8qB8,3417
|
5
|
+
collections_cache-0.2.6.20250303.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
6
|
+
collections_cache-0.2.6.20250303.dist-info/RECORD,,
|
@@ -1,6 +0,0 @@
|
|
1
|
-
collections_cache/__init__.py,sha256=uUp8lhp-HnZRumnU_8MT6qVq95t0pOzn7oLW7ARbnvc,48
|
2
|
-
collections_cache/collections_cache.py,sha256=VNCzP4fZSL-BUXDVqwa9aXfU4JWJHMKNei5v15aua6E,5109
|
3
|
-
collections_cache-0.2.4.20250303.dist-info/LICENSE,sha256=RAIL-FmXSiNRgyiVlfhm2SvVI4XDVsN0jDt9207SJ8o,1168
|
4
|
-
collections_cache-0.2.4.20250303.dist-info/METADATA,sha256=bvPNOKkl-8zxK6EremVvzwjrpYCLAU4peoRdcMCvXqk,3417
|
5
|
-
collections_cache-0.2.4.20250303.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
6
|
-
collections_cache-0.2.4.20250303.dist-info/RECORD,,
|
{collections_cache-0.2.4.20250303.dist-info → collections_cache-0.2.6.20250303.dist-info}/LICENSE
RENAMED
File without changes
|
{collections_cache-0.2.4.20250303.dist-info → collections_cache-0.2.6.20250303.dist-info}/WHEEL
RENAMED
File without changes
|