Skip to main content

Expiring Dict

https://travis-ci.org/weaming/expiringdict.svg?branch=master

expiringdict is a Python caching library. The core of the library is ExpiringDict class which is an ordered dictionary with auto-expiring values for caching purposes. Expiration happens on any access, object is locked during cleanup from expired values. ExpiringDict can not store more than max_len elements - the oldest will be deleted.

Note: Iteration over dict and also keys() do not remove expired values!

Features after fork

  • optioinal default value passed by dict after keys expired

Installation

If you wish to install from PyPi:

pip install expiringdict-with-default

If you wish to download the source and install from GitHub:

git clone git@github.com:weaming/expiringdict.git
python setup.py install

To run tests with coverage:

nosetests --with-coverage --cover-package=expiringdict

Usage

Create a dictionary with capacity for 100 elements and elements expiring in 10 seconds:

from expiringdict import ExpiringDict
cache = ExpiringDict(max_len=100, max_age_seconds=10, default={'name': 'Alice'})

put and get a value there:

cache["key"] = "value"
cache.get("key")

Metadata

Release files for expiringdict-with-default 1.1.7

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

Source distribution (sdist)

Source distribution for expiringdict-with-default 1.1.7
File Size Uploaded Provenance
expiringdict_with_default-1.1.7.tar.gz 7.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for expiringdict-with-default 1.1.7
File Interpreter ABI Platform
expiringdict_with_default-1.1.7-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 10.7 kB

Release files / expiringdict_with_default-1.1.7.tar.gz

Download URL expiringdict_with_default-1.1.7.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0de8e3158292fbab584f758f1b94fea34a764497d1c8dd807f7ad83c4e0d13f1
BLAKE2b-256 checksum
How to use checksums
0a878e844ea799327c47706c17763bed4df77b4741bdf21a3fc89756c1aa5ec1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / expiringdict_with_default-1.1.7-py2.py3-none-any.whl

Download URL expiringdict_with_default-1.1.7-py2.py3-none-any.whl
Size 3.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
6222e846a341e699f7561adfd460598a92c873692fe0f5003767d67551f4b7cd
BLAKE2b-256 checksum
How to use checksums
b52f92a26b95d84454e647c550f7dbd5e75b8e918ee0f3c35af28f95f3e518a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for expiringdict-with-default 1.1.7

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.

Release history Release notifications | RSS feed

This release

1.1.7 This release

2 release files No provenance

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