collections-cache 0.2.9.20250303__py3-none-any.whl → 0.3.1.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.
@@ -5,18 +5,18 @@ 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
9
8
 
10
9
  class Collection_Cache:
11
- def __init__(self, collection_name):
10
+ def __init__(self, collection_name: str, constant_per_core: int = 100):
12
11
  # Variables
13
12
  self.collection_name = collection_name
13
+ self.constant_per_core = constant_per_core
14
14
  self.cpu_cores = cpu_count()
15
+ self.size_limit = self.constant_per_core * self.cpu_cores
15
16
  self.collection_dir = path.join("./Collections", self.collection_name)
16
17
  self.databases_list = []
17
18
  self.keys_databases = {}
18
19
  self.temp_keys_values = {}
19
- self.size_limit = 200
20
20
 
21
21
  # Init methods
22
22
  self.create_collection()
@@ -73,7 +73,7 @@ class Collection_Cache:
73
73
  if type_of_operation == "set_key" and len(self.temp_keys_values) >= self.size_limit:
74
74
  self.set_multi_keys(self.temp_keys_values)
75
75
  self.temp_keys_values = {}
76
- else:
76
+ elif type_of_operation == "get_key":
77
77
  self.set_multi_keys(self.temp_keys_values)
78
78
  self.temp_keys_values = {}
79
79
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: collections-cache
3
- Version: 0.2.9.20250303
3
+ Version: 0.3.1.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=0nOL9kPSy_rMs03Ev1goLKgaq9qT_j4cmojrb07Deaw,6013
3
+ collections_cache-0.3.1.20250303.dist-info/LICENSE,sha256=RAIL-FmXSiNRgyiVlfhm2SvVI4XDVsN0jDt9207SJ8o,1168
4
+ collections_cache-0.3.1.20250303.dist-info/METADATA,sha256=9gavZ1Gk8Q1HkMwos-GP0NXgLZvIuWVBFTsyi5ZA6ws,4993
5
+ collections_cache-0.3.1.20250303.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
6
+ collections_cache-0.3.1.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=z9qQfnKFiO5sLf4py7o_FgviuPlOTFao3SJH7bKqhLo,5899
3
- collections_cache-0.2.9.20250303.dist-info/LICENSE,sha256=RAIL-FmXSiNRgyiVlfhm2SvVI4XDVsN0jDt9207SJ8o,1168
4
- collections_cache-0.2.9.20250303.dist-info/METADATA,sha256=WEyJDnHBpdRXpWLGsEmVnI--6MdZ8wSPCyJhi_a1N5M,4993
5
- collections_cache-0.2.9.20250303.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
6
- collections_cache-0.2.9.20250303.dist-info/RECORD,,