Frazer McLean

Maître d':
Ah, good afternoon, sir; and how are we today?

Mr Creosote:
Better.

Maître d':
Better?

Mr Creosote:
Better get a bucket, I'm gonna throw up.

I wrote BucketCache to help me speed up some data analysis which had lots of independent stages. This allowed me to use the results of previous calculations rather than have to wait for them to run again just because something in a later stage of my script changed.

from bucketcache import Bucket

bucket = Bucket('cache', hours=1)

bucket[any_object] = anything_serializable_by_backend  # (Pickle is the default)

@bucket
def analysis(spam, eggs):
    ...

# Normal function call loads result from file if it exists.
analysis(spam=4, eggs=5)