collections-cache 0.2.1__py3-none-any.whl → 0.2.3__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 -4
- {collections_cache-0.2.1.dist-info → collections_cache-0.2.3.dist-info}/METADATA +1 -1
- collections_cache-0.2.3.dist-info/RECORD +6 -0
- collections_cache-0.2.1.dist-info/RECORD +0 -6
- {collections_cache-0.2.1.dist-info → collections_cache-0.2.3.dist-info}/LICENSE +0 -0
- {collections_cache-0.2.1.dist-info → collections_cache-0.2.3.dist-info}/WHEEL +0 -0
@@ -3,8 +3,8 @@ import sqlite3
|
|
3
3
|
from random import choice
|
4
4
|
from itertools import chain
|
5
5
|
from os import cpu_count, path, makedirs, scandir
|
6
|
-
|
7
|
-
from concurrent.futures import ThreadPoolExecutor as
|
6
|
+
from concurrent.futures import ProcessPoolExecutor as Pool
|
7
|
+
from concurrent.futures import ThreadPoolExecutor as Thread
|
8
8
|
|
9
9
|
class Collection_Cache:
|
10
10
|
def __init__(self, collection_name):
|
@@ -73,8 +73,8 @@ class Collection_Cache:
|
|
73
73
|
|
74
74
|
def set_multi_keys(self, keys_and_values: dict[str, any]):
|
75
75
|
"""Experimental. Set multiple keys and values at the same time."""
|
76
|
-
with
|
77
|
-
|
76
|
+
with Thread(self.cpu_cores) as thread:
|
77
|
+
thread.map(lambda kv: self.set_key(kv[0], kv[1]), keys_and_values.items())
|
78
78
|
|
79
79
|
def add_to_keys_database(self, key, database):
|
80
80
|
self.keys_databases[key] = database
|
@@ -115,9 +115,13 @@ class Collection_Cache:
|
|
115
115
|
return error
|
116
116
|
|
117
117
|
def configure_connection(self, conn):
|
118
|
+
conn.execute("PRAGMA auto_vacuum = FULL;")
|
118
119
|
conn.execute("PRAGMA journal_mode = WAL;")
|
119
120
|
conn.execute("PRAGMA synchronous = NORMAL;")
|
120
121
|
conn.execute("PRAGMA wal_autocheckpoint = 1000;")
|
122
|
+
conn.execute("PRAGMA cache_size = -2000;")
|
123
|
+
conn.execute("PRAGMA temp_store = MEMORY;")
|
124
|
+
conn.execute("PRAGMA optimize;")
|
121
125
|
|
122
126
|
def keys(self):
|
123
127
|
"""Returns all stored keys"""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: collections-cache
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.3
|
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=HWTwxrXsMc3sRcsrRkLugp_QtbBASvem6kBQShMEYO4,5133
|
3
|
+
collections_cache-0.2.3.dist-info/LICENSE,sha256=RAIL-FmXSiNRgyiVlfhm2SvVI4XDVsN0jDt9207SJ8o,1168
|
4
|
+
collections_cache-0.2.3.dist-info/METADATA,sha256=_NbnncpG10Jlw4cwh_p4TgaVD0k18d7AWF07VwyUt3Y,3408
|
5
|
+
collections_cache-0.2.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
6
|
+
collections_cache-0.2.3.dist-info/RECORD,,
|
@@ -1,6 +0,0 @@
|
|
1
|
-
collections_cache/__init__.py,sha256=uUp8lhp-HnZRumnU_8MT6qVq95t0pOzn7oLW7ARbnvc,48
|
2
|
-
collections_cache/collections_cache.py,sha256=E610JrTKVnu2SjA6IGRJDMrAG9_BwrGq9gTuRj0d-yQ,4931
|
3
|
-
collections_cache-0.2.1.dist-info/LICENSE,sha256=RAIL-FmXSiNRgyiVlfhm2SvVI4XDVsN0jDt9207SJ8o,1168
|
4
|
-
collections_cache-0.2.1.dist-info/METADATA,sha256=iU4UgRbo17FdBbcHftNrnYY6IUT2rNmkNePmRIHdYzI,3408
|
5
|
-
collections_cache-0.2.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
6
|
-
collections_cache-0.2.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|