Time based function caching
Project description
temporal-cache
Time-based cache invalidation
Install
From pip
pip install temporal-cache
Or from source
python setup.py install
Why?
I needed something that would automagically refresh at 4:00pm when markets close.
@expire(hour=16)
def fetchFinancialData():
Interval Cache
The interval cache expires every time
interval since its first use
@interval(seconds=5, minutes=2)
def myfoo():
'''myfoo's lru_cache will expire 2 minutes, 5 seconds after last use'''
Expire Cache
The expire cache expires on the time given, in scheduler/cron style.
@expire(second=5, minute=2)
def myfoo():
'''myfoo's lru_cache will expire on the second minute, fifth second of every hour, every day, etc'''
Caveats
Python hashing symantics persist. Dicts will be frozen, lists will be converted to tuples. Users are advised to pre-freeze to avoid issues.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
temporal-cache-0.1.4.tar.gz
(15.0 kB
view details)
Built Distribution
File details
Details for the file temporal-cache-0.1.4.tar.gz
.
File metadata
- Download URL: temporal-cache-0.1.4.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6dd850359c46bd4a5c59fc3b953f8924e429b1179a351b3508d07c214738b50 |
|
MD5 | 2c2e129f90e57fd64a411f99264742d3 |
|
BLAKE2b-256 | 0f6c792cc73744d87d49e343f47cf552bffd3ebfb9019a37c68e7fe4a4c66c4d |
File details
Details for the file temporal_cache-0.1.4-py2.py3-none-any.whl
.
File metadata
- Download URL: temporal_cache-0.1.4-py2.py3-none-any.whl
- Upload date:
- Size: 17.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d9a83bc247b8e1fc51bcbae0fe650ae510fa67818a19a688f93ae27a9298e7d |
|
MD5 | 17fa84229b232c2007d165c40fb32778 |
|
BLAKE2b-256 | 07fb53fee1558059f2e8acb08be270b2af1fdc32e29932f63ff967bf5d451249 |