Skip to main content

collections-cache

collections-cache is a simple and efficient caching solution built with SQLite databases. It allows storing, updating, and retrieving data using unique keys while supporting complex data types through pickle. Designed to scale across multiple CPU cores, it distributes data across multiple SQLite databases for improved performance.

Features

  • Multiple SQLite databases: Distributes data across multiple databases for better scalability.
  • Key-value store: Stores data as key-value pairs.
  • Supports complex data types: Data is serialized using pickle, allowing you to store lists, dictionaries, and other Python objects.
  • Parallel processing: Utilizes Python’s multiprocessing module to handle large collections in parallel across multiple CPU cores.
  • Efficient data retrieval: Retrieves stored data efficiently based on the key.
  • Cross-platform: Works on Linux, macOS, and Windows.

Installation

To install the collections-cache package, use Poetry to manage dependencies.

  1. Clone the repository:

    git clone https://github.com/Luiz-Trindade/collections_cache.git
    cd collections-cache
    
  2. Install the package with Poetry:

    poetry install
    

Usage

To use the collections-cache package, import the main class Collection_Cache and interact with your collection.

Example

from collections_cache import Collection_Cache

# Create a new collection
cache = Collection_Cache("STORE")

# Set a key-value pair
cache.set_key("products", ["apple", "orange", "onion"])

# Get the value by key
products = cache.get_key("products")
print(products)  # Output: ['apple', 'orange', 'onion']

Methods

  • set_key(key, value): Stores a key-value pair in the cache. If the key already exists, its value is updated.
  • set_multi_keys(key_and_value): Stores a multi key-value pair in the cache. If the key already exists, its value is updated.
  • get_key(key): Retrieves the value associated with a key.
  • delete_key(key): Removes an existing key from the cache.
  • keys*: Returns all stored keys.

Development

To contribute or run tests:

  1. Install development dependencies:

    poetry install --dev
    
  2. Run tests:

    poetry run pytest
    

License

This project is licensed under the MIT License – see the LICENSE file for details.

Acknowledgements

  • This package was created to demonstrate how to work with SQLite, pickle, and Python's multiprocessing module.
  • Created by: Luiz Trindade.

Metadata

Release files for collections-cache 0.2.6.20250303

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for collections-cache 0.2.6.20250303
File Size Uploaded Provenance Actions
collections_cache-0.2.6.20250303.tar.gz 4.2 kB Without provenance Details for collections_cache-0.2.6.20250303.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for collections-cache 0.2.6.20250303
File Interpreter ABI Platform Actions
collections_cache-0.2.6.20250303-py3-none-any.whl Python 3 none any Details for collections_cache-0.2.6.20250303-py3-none-any.whl

Total release size: 9.3 kB

Release files / collections_cache-0.2.6.20250303.tar.gz

Download URL collections_cache-0.2.6.20250303.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c5c36b75b2d6c0ec9b72264859cc84bc89c9e2dcdafd72b95972c7e6588c11a0
BLAKE2b-256 checksum
How to use checksums
8b8e4238022bb489bf23309f2033e2f6050312f307ca1f86ee7da5384f300293
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.3 Linux/6.11.0-17-generic

Release files / collections_cache-0.2.6.20250303-py3-none-any.whl

Download URL collections_cache-0.2.6.20250303-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
addb7b8c154dcbb35b813cc416028737713ea60b0b680df92045ddef9dc9e07c
BLAKE2b-256 checksum
How to use checksums
3cd68a6633afe4efb0052c071738a594c70e8f1ec4934552d3d8a0d12e878b81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.3 Linux/6.11.0-17-generic

Security for collections-cache 0.2.6.20250303

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page