collections-cache 0.3.6.20250420__py3-none-any.whl → 0.3.8.20250420__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.
@@ -78,21 +78,15 @@ class Collection_Cache:
78
78
  if type_of_operation == "set_key" and len(self.temp_keys_values) >= self.size_limit:
79
79
  self.set_multi_keys(self.temp_keys_values)
80
80
  self.temp_keys_values = {}
81
- elif type_of_operation == "get_key":
82
- self.set_multi_keys(self.temp_keys_values)
83
- self.temp_keys_values = {}
84
- elif type_of_operation == "set_key_force":
81
+ elif type_of_operation == "get_key" or type_of_operation == "set_key_force":
85
82
  self.set_multi_keys(self.temp_keys_values)
86
83
  self.temp_keys_values = {}
87
84
 
88
85
  # Experimental
89
86
  def set_key(self, key: str, value: any):
90
87
  """Used to store values and associate a value with a key."""
91
- self.temp_keys_values[key] = value
92
- #self.verify_size_of_temp_queue("set_key")
93
-
94
- t = Thread(target=self.verify_size_of_temp_queue, args=("set_key",))
95
- t.start()
88
+ self.temp_keys_values[key] = value
89
+ self.verify_size_of_temp_queue("set_key")
96
90
 
97
91
  def set_key_exec(self, key: str, value: any):
98
92
  """Used to store values and associate a value with a key."""
@@ -120,6 +114,12 @@ class Collection_Cache:
120
114
  with Thread(self.cpu_cores) as thread:
121
115
  thread.map(lambda kv: self.set_key_exec(kv[0], kv[1]), keys_and_values.items())
122
116
 
117
+ # New feature
118
+ def set_key_force(self, key: str, value: any):
119
+ """Used to force a unique key to be stored"""
120
+ self.set_key(key, value)
121
+ self.verify_size_of_temp_queue("set_key_force")
122
+
123
123
  def add_to_keys_database(self, key, database):
124
124
  self.keys_databases[key] = database
125
125
 
@@ -179,7 +179,7 @@ class Collection_Cache:
179
179
  def export_to_json(self):
180
180
  """Test"""
181
181
  pass
182
-
182
+
183
183
  def shutdown(self):
184
184
  """Save all keys to the collection before close or shutdown"""
185
185
  self.verify_size_of_temp_queue("set_key_force")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: collections-cache
3
- Version: 0.3.6.20250420
3
+ Version: 0.3.8.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
@@ -0,0 +1,6 @@
1
+ collections_cache/__init__.py,sha256=uUp8lhp-HnZRumnU_8MT6qVq95t0pOzn7oLW7ARbnvc,48
2
+ collections_cache/collections_cache.py,sha256=nFm_77HlR88iJlmmvZpRh8fit19vwB1oiCD2T_AzZ5g,6814
3
+ collections_cache-0.3.8.20250420.dist-info/LICENSE,sha256=RAIL-FmXSiNRgyiVlfhm2SvVI4XDVsN0jDt9207SJ8o,1168
4
+ collections_cache-0.3.8.20250420.dist-info/METADATA,sha256=UV9sKNFXrkRQNzTXZo0uYtd1I7sycY5tDYDSbsJui34,5770
5
+ collections_cache-0.3.8.20250420.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
6
+ collections_cache-0.3.8.20250420.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- collections_cache/__init__.py,sha256=uUp8lhp-HnZRumnU_8MT6qVq95t0pOzn7oLW7ARbnvc,48
2
- collections_cache/collections_cache.py,sha256=r6h6xFsDvnd9GQbRiq8up4EEbo58DWWDbFDrbudlRQg,6800
3
- collections_cache-0.3.6.20250420.dist-info/LICENSE,sha256=RAIL-FmXSiNRgyiVlfhm2SvVI4XDVsN0jDt9207SJ8o,1168
4
- collections_cache-0.3.6.20250420.dist-info/METADATA,sha256=XK5wzZ5pY7UPSou37unWHtShYtXvuSVIrzr0_5EzEY4,5770
5
- collections_cache-0.3.6.20250420.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
6
- collections_cache-0.3.6.20250420.dist-info/RECORD,,