collections-cache 0.3.1.20250303__tar.gz → 0.3.3.20250303__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.
- {collections_cache-0.3.1.20250303 → collections_cache-0.3.3.20250303}/PKG-INFO +1 -1
- {collections_cache-0.3.1.20250303 → collections_cache-0.3.3.20250303}/collections_cache/collections_cache.py +12 -1
- {collections_cache-0.3.1.20250303 → collections_cache-0.3.3.20250303}/pyproject.toml +1 -1
- {collections_cache-0.3.1.20250303 → collections_cache-0.3.3.20250303}/LICENSE +0 -0
- {collections_cache-0.3.1.20250303 → collections_cache-0.3.3.20250303}/README.md +0 -0
- {collections_cache-0.3.1.20250303 → collections_cache-0.3.3.20250303}/collections_cache/__init__.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: collections-cache
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.3.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
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import atexit
|
1
2
|
import pickle
|
2
3
|
import sqlite3
|
3
4
|
from random import choice
|
@@ -22,11 +23,14 @@ class Collection_Cache:
|
|
22
23
|
self.create_collection()
|
23
24
|
self.get_all_databases()
|
24
25
|
|
26
|
+
# Shutdown method
|
27
|
+
atexit.register(self.shutdown)
|
28
|
+
|
25
29
|
def configure_connection(self, conn):
|
26
30
|
conn.executescript("""
|
31
|
+
PRAGMA synchronous = OFF;
|
27
32
|
PRAGMA auto_vacuum = FULL;
|
28
33
|
PRAGMA journal_mode = WAL;
|
29
|
-
PRAGMA synchronous = NORMAL;
|
30
34
|
PRAGMA wal_autocheckpoint = 1000;
|
31
35
|
PRAGMA cache_size = -2000;
|
32
36
|
PRAGMA temp_store = MEMORY;
|
@@ -76,6 +80,9 @@ class Collection_Cache:
|
|
76
80
|
elif type_of_operation == "get_key":
|
77
81
|
self.set_multi_keys(self.temp_keys_values)
|
78
82
|
self.temp_keys_values = {}
|
83
|
+
elif type_of_operation == "set_key_force":
|
84
|
+
self.set_multi_keys(self.temp_keys_values)
|
85
|
+
self.temp_keys_values = {}
|
79
86
|
|
80
87
|
# Experimental
|
81
88
|
def set_key(self, key: str, value: any):
|
@@ -159,3 +166,7 @@ class Collection_Cache:
|
|
159
166
|
def export_to_json(self):
|
160
167
|
"""Test"""
|
161
168
|
pass
|
169
|
+
|
170
|
+
def shutdown(self):
|
171
|
+
"""Save all keys to the collection before close or shutdown"""
|
172
|
+
self.verify_size_of_temp_queue("set_key_force")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "collections-cache"
|
3
|
-
version = "0.3.
|
3
|
+
version = "0.3.3.20250303"
|
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"
|
File without changes
|
File without changes
|
{collections_cache-0.3.1.20250303 → collections_cache-0.3.3.20250303}/collections_cache/__init__.py
RENAMED
File without changes
|