web_cache

Simple persistent cache storage, with different cache eviction strategies, and optional compression


Keywords
cache, sqlite3, key-value, persistent
Licenses
LGPL-3.0/GPL-3.0+
Install
pip install web_cache==1.1.0

Documentation

Web cache

Latest version Tests status Coverage Supported Python versions License

Python module for simple key-value storage backed up by sqlite3 database. The typical use case is a URL to HTTP data cache, but it can also be used for non web ressources.

Features

  • Simple dict interface allows natural usage (if key in cache, value = cache[key], etc.)
  • Optional Zlib (deflate), BZIP2, LZMA or ZSTD (Zstandard) compression, with configurable compression level
  • FIFO or LRU cache eviction strategies
  • Optional thread safe interface to work around Python Sqlite3 'same thread' limitation
  • Provides cache hit rate statistics

Installation (from PyPI, with PIP)

web_cache requires Python >= 3.4.

  1. If you don't already have it, install pip for Python 3
  2. Install web_cache: pip3 install web_cache

License

LGPLv2