expiring_lru_cache
expiring_lru_cache is a minimal drop-in replacement of functools.lru_cache. It
allows the user to specify a time interval (in secs) after which the cache is
invalidated and reset.
Usage
Here an example cached function whose cache will invalidate after 10 seconds.
from expiring_lru_cache import lru_cache
@lru_cache(expires_after=10)
def my_plus_one_func(x: int) -> int:
return x + 1
Here an example cached function whose cache will invalidate after 1 day. Note that the
convenience variables MINUTES, HOURS and DAYS are available within the
expiring_lru_cache namespace.
from expiring_lru_cache import lru_cache, DAYS
@lru_cache(expires_after=1 * DAYS)
def my_plus_one_func(x: int) -> int:
return x + 1
Metadata
Release files for expiring-lru-cache 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| expiring_lru_cache-0.1.1.tar.gz | 3.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| expiring_lru_cache-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.1 kB
Release files / expiring_lru_cache-0.1.1.tar.gz
| Download URL | expiring_lru_cache-0.1.1.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc5bd99cdd344345782557a7bf5e6526966299a4e8b7eb373eda10f869bfc7d5
|
|
BLAKE2b-256 checksum How to use checksums |
4f6be281e03a3ca0e10bfff20894294c892e5295e7f0baafed8225d2b6e29459
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.10.14 Linux/6.5.0-1022-azure
|
Release files / expiring_lru_cache-0.1.1-py3-none-any.whl
| Download URL | expiring_lru_cache-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
016ab8770a3848c74103476f888553305659210fa88b9cf296f5427f81e8b359
|
|
BLAKE2b-256 checksum How to use checksums |
02309cd093daa9899edfbbf05691a608b8a5e9d329b26072c764ef75b0b816b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.10.14 Linux/6.5.0-1022-azure
|