Skip to main content

Time based function caching

Project description

temporal-cache

Time-based cache invalidation

Build Status Coverage BCH compliance License PyPI Docs

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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

temporal_cache-0.0.5-py2.py3-none-any.whl (13.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file temporal-cache-0.0.5.tar.gz.

File metadata

  • Download URL: temporal-cache-0.0.5.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/0.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.5

File hashes

Hashes for temporal-cache-0.0.5.tar.gz
Algorithm Hash digest
SHA256 835dca1fb821cf98c7cf5edc576031ef234d062acb44b63129cc37f87790ea67
MD5 d5bc6f3244f9b83682ac240c818c3479
BLAKE2b-256 e16743e0ffcf72f54c6c2c04d830b1fad017526823a315ea213be8452bcc67b7

See more details on using hashes here.

File details

Details for the file temporal_cache-0.0.5-py2.py3-none-any.whl.

File metadata

  • Download URL: temporal_cache-0.0.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/0.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.5

File hashes

Hashes for temporal_cache-0.0.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8386d1f66bc81c80814ac530b1025a437bbf075ce75535be70ef870b2cdbd20a
MD5 160a3dfe3f762f8b93a91ee566b8879c
BLAKE2b-256 e27ad06344ea5c61c6e76e16b55c8db660e9b9da37da12d6ff622193eaf4b653

See more details on using hashes here.

Supported by

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