Time based function caching
Project description
# temporal-cache
Time-based cache invalidation
[![Build Status](https://travis-ci.org/timkpaine/temporal-cache.svg?branch=master)](https://travis-ci.org/timkpaine/temporal-cache)
[![Coverage](https://codecov.io/gh/timkpaine/temporal-cache/branch/master/graph/badge.svg)](https://codecov.io/gh/timkpaine/temporal-cache)
[![Waffle.io](https://badge.waffle.io/timkpaine/temporal-cache.png?label=ready&title=Ready)](https://waffle.io/timkpaine/temporal-cache?utm_source=badge)
[![BCH compliance](https://bettercodehub.com/edge/badge/timkpaine/temporal-cache?branch=master)](https://bettercodehub.com/)
[![License](https://img.shields.io/github/license/timkpaine/temporal-cache.svg)](https://pypi.python.org/pypi/temporal-cache/)
[![PyPI](https://img.shields.io/pypi/v/temporal-cache.svg)](https://pypi.python.org/pypi/temporal-cache/)
[![Docs](https://img.shields.io/readthedocs/temporal-cache.svg)](https://temporal-cache.readthedocs.io)
## Interval Cache
The interval cache expires every `time` interval since its first use
```python3
@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.
```python3
@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'''
```
Time-based cache invalidation
[![Build Status](https://travis-ci.org/timkpaine/temporal-cache.svg?branch=master)](https://travis-ci.org/timkpaine/temporal-cache)
[![Coverage](https://codecov.io/gh/timkpaine/temporal-cache/branch/master/graph/badge.svg)](https://codecov.io/gh/timkpaine/temporal-cache)
[![Waffle.io](https://badge.waffle.io/timkpaine/temporal-cache.png?label=ready&title=Ready)](https://waffle.io/timkpaine/temporal-cache?utm_source=badge)
[![BCH compliance](https://bettercodehub.com/edge/badge/timkpaine/temporal-cache?branch=master)](https://bettercodehub.com/)
[![License](https://img.shields.io/github/license/timkpaine/temporal-cache.svg)](https://pypi.python.org/pypi/temporal-cache/)
[![PyPI](https://img.shields.io/pypi/v/temporal-cache.svg)](https://pypi.python.org/pypi/temporal-cache/)
[![Docs](https://img.shields.io/readthedocs/temporal-cache.svg)](https://temporal-cache.readthedocs.io)
## Interval Cache
The interval cache expires every `time` interval since its first use
```python3
@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.
```python3
@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'''
```
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.0.2.tar.gz
(3.6 kB
view hashes)