Skip to main content

Persistent caching decorator

Project description

filecache

filecache is a decorator which saves the return value of functions even
after the interpreter dies. For example this is useful on functions that download
and parse webpages for example. All you need to do is specify for how long
the return values should be cached (use seconds, like time.sleep).

USAGE:

from filecache import filecache

@filecache(24 * 60 * 60)
def time_consuming_function(args):
# etc


NOTE: All arguments of the decorated function and the return value need to be
picklable for this to work.

NOTE: The cache isn't automatically cleaned, it is only overwritten. If your
function can receive many different arguments that rarely repeat, your
cache may forever grow. One day I might add a feature that once in every
100validity scans the db for outdated stuff and erases.

Tested on python 2.7 and 3.1

License: BSD, do what you wish with this. Could be awesome to hear if you found
it useful and/or you have suggestions. ubershmekel at gmail

Project details


Release history Release notifications

History Node

0.77

History Node

0.75

History Node

0.71

History Node

0.69

History Node

0.67

History Node

0.66

History Node

0.65

History Node

0.64

This version
History Node

0.63

History Node

0.62

History Node

0.61

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
filecache-0.63.zip (6.7 kB) Copy SHA256 hash SHA256 Source None Feb 13, 2011

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page