Skip to main content

Time based function caching

Project description

temporal-cache

Time based function caching

Build Status codecov License PyPI

Install

From pip:

pip install temporal-cache

From conda:

conda install temporal-cache -c conda-forge

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


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.6.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

temporal_cache-0.1.6-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file temporal_cache-0.1.6.tar.gz.

File metadata

  • Download URL: temporal_cache-0.1.6.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.11

File hashes

Hashes for temporal_cache-0.1.6.tar.gz
Algorithm Hash digest
SHA256 ad26a9b11d40fd168dec79890ab44ddf63ded6a37d500263454ffac7b6bdf224
MD5 4da9169154b4deb9da1971aeaea656a7
BLAKE2b-256 ecfb51fcb05f2de0d7d9cbe45426448848bb13ff7c5cea6481d43fe1e88907d2

See more details on using hashes here.

File details

Details for the file temporal_cache-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: temporal_cache-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.11

File hashes

Hashes for temporal_cache-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 1bdf8afca4422afadebdcbafc56e2453be2de5c466804cb586b92f357a91ca0c
MD5 0d5697879c19bdc3d13eb453802590ed
BLAKE2b-256 af5d6ef5ba0da67c39c8cefbd4f64be7069512316dffe441e078e892b3f4aed0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page