Skip to main content

Time based function caching

Project description

temporal-cache

Time-based cache invalidation

Build Status Coverage License PyPI Docs

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


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

Uploaded Source

Built Distribution

temporal_cache-0.1.3-py2.py3-none-any.whl (17.7 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: temporal-cache-0.1.3.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

Hashes for temporal-cache-0.1.3.tar.gz
Algorithm Hash digest
SHA256 718ac53081f748038ee54561395bbead4d9340277777a8a37a6ef5b0b1e730cf
MD5 7129eae08d5573de3d5a20b4fd671a85
BLAKE2b-256 950390bf3173fe7f0355f502f2019ba773b5974097c1d99acdfa374ba363b1b8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: temporal_cache-0.1.3-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.8.6

File hashes

Hashes for temporal_cache-0.1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8ebb2211a601f9f215379c726d8b31521e4d12277584883529852c382f0170d0
MD5 52b39bbfa021b4c6288a937fc3ea5d5c
BLAKE2b-256 d629dfb7903e233f73eafb997cd2e6796ee36dbecf7b7cb8e9122fd762ebd7ab

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