Skip to main content

Time based function caching

Project description


Time-based cache invalidation

Build Status Coverage License PyPI Docs


From pip

pip install temporal-cache

Or from source

python install


I needed something that would automagically refresh at 4:00pm when markets close.

    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'''


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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for temporal-cache, version 0.1.4
Filename, size File type Python version Upload date Hashes
Filename, size temporal_cache-0.1.4-py2.py3-none-any.whl (17.7 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size temporal-cache-0.1.4.tar.gz (15.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page