collections-cache 0.3.4.20250419__tar.gz → 0.3.5.20250420__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.3
2
2
  Name: collections-cache
3
- Version: 0.3.4.20250419
3
+ Version: 0.3.5.20250420
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
@@ -13,7 +13,8 @@ class Collection_Cache:
13
13
  self.collection_name = collection_name
14
14
  self.constant_per_core = constant_per_core
15
15
  self.cpu_cores = cpu_count()
16
- self.size_limit = self.constant_per_core * self.cpu_cores
16
+ #self.size_limit = self.constant_per_core * self.cpu_cores
17
+ self.size_limit = 1
17
18
  self.collection_dir = path.join("./Collections", self.collection_name)
18
19
  self.databases_list = []
19
20
  self.keys_databases = {}
@@ -126,9 +127,13 @@ class Collection_Cache:
126
127
 
127
128
  def get_key(self, key: str):
128
129
  """Used to obtain the value stored by the key"""
129
- self.get_all_databases()
130
- self.verify_size_of_temp_queue("get_key")
131
130
  try:
131
+ if key not in self.keys_databases:
132
+ self.verify_size_of_temp_queue("get_key")
133
+
134
+ if key not in self.keys_databases:
135
+ return None
136
+
132
137
  database_to_search = self.keys_databases[key]
133
138
  conn = sqlite3.connect(database_to_search)
134
139
  self.configure_connection(conn)
@@ -136,8 +141,12 @@ class Collection_Cache:
136
141
  cursor.execute("SELECT value FROM data WHERE key = ?", (key,))
137
142
  result = cursor.fetchall()
138
143
  conn.close()
139
- return pickle.loads(result[0][0])
140
-
144
+
145
+ #return pickle.loads(result[0][0])
146
+ if result:
147
+ return pickle.loads(result[0][0])
148
+ return None
149
+
141
150
  except Exception as error:
142
151
  return None
143
152
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "collections-cache"
3
- version = "0.3.4.20250419"
3
+ version = "0.3.5.20250420"
4
4
  description = "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
  authors = ["Luiz-Trindade <luiz.gabriel.m.trindade@gmail.com>"]
6
6
  license = "MIT"