lite-cache
| Branch | Build Status |
|---|---|
master |
|
develop |
Simple sqlite key-value storage for Python3.
Python3 module for caching data during a program's runtime, with optional persistence.
Features
- Program specific cache.
- Simple encoding of data using standard
jsonpackage. - Optional persistence of data across multiple executions.
- Useful for keeping some runtime data available to a program after a full exit.
- ex.
raise Exceptionorsys.exit(), etc
- ex.
- Useful for keeping some runtime data available to a program after a full exit.
Installation (from PyPI, with PIP)
lite-cache requires Python >= 3.6.
- If not already installed, install pip for Python 3
- Install
lite_cache$ pip3 install lite-cache
Usage
To use in default configuration:
- Entire cache is in 1 database file,
~/.local/litecache/cache.db
To use in custom configuration:
import lite_cache
program_cache = lite_cache.LiteCache(name='MyProgramCache', location='~/.local/litecache')
# This initializes and creates a new Sqlite3 database file in `location` directory,
# named as "`name`.cache".
# If directory does not exist, error is raised.
This strategy of having unique caches for each program is designed to navigate "same thread" or "single thread" issues with Python & Sqlite3.
- This would not prevent issues occurring if multiple instances of the same program were launched on the same machine.
- ie. Executing same Python script in 2 terminal tabs. This would lead to two(2) threads attempting to access one(1) Sqlite3 with same
name
- ie. Executing same Python script in 2 terminal tabs. This would lead to two(2) threads attempting to access one(1) Sqlite3 with same
Development
This project uses pipenv for managing virtual-environments and Python3 dependencies for development and testing.
- Reference: https://pypi.org/project/pipenv/
The standard requirements.txt is included for installation via setup.py
Tests
- Uses
unittests
Run all tests from setup.py
pipenv run python setup.py test
Run specific test
pipenv run python -m unittest tests/test_main.py
Plans
- Interface for handling Python+Sqlite3 thread limitations.
- Data compression options
License
Metadata
Release files for lite-cache 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lite-cache-0.1.3.tar.gz | 19.4 kB | Without provenance | Details for lite-cache-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lite_cache-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for lite_cache-0.1.3-py3-none-any.whl |
Total release size: 36.5 kB
Release files / lite-cache-0.1.3.tar.gz
| Download URL | lite-cache-0.1.3.tar.gz |
|---|---|
| Size | 19.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee9685c579b27cedb5b69cf5bd4d47d646369c08129c74a271b96c7d200ad302
|
|
BLAKE2b-256 checksum How to use checksums |
87ff6d967f5e138a5216bc850bee25d10ae99b1b9df2ba3be259342285b3ab19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8+
|
Release files / lite_cache-0.1.3-py3-none-any.whl
| Download URL | lite_cache-0.1.3-py3-none-any.whl |
|---|---|
| Size | 17.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f2223e7ee2a33c8ffe16c3e7aacf1c8d79c2dec32616e082694f4e06ab09d7ee
|
|
BLAKE2b-256 checksum How to use checksums |
7c9fe71a7aa88cd177c57e9c2df91fed392c120f42614f31f6733b10ef7a76a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8+
|
Security for lite-cache 0.1.3
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.