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


Download files

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

Source Distribution

filecache-0.64.zip (6.7 kB view details)

Uploaded Source

Built Distribution

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

filecache-0.64.win32.zip (8.6 kB view details)

Uploaded Source

File details

Details for the file filecache-0.64.zip.

File metadata

  • Download URL: filecache-0.64.zip
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for filecache-0.64.zip
Algorithm Hash digest
SHA256 4fd0d4d5899059cbadf4fded6d52430534f4c83b5d314f579da5cf0454f28cd5
MD5 6817cc1a96aa29a03c4d3cb949ded43a
BLAKE2b-256 277190921b5d442db4c1215d13be309d60fd95f0aa1da5d8c2a31761ec50d4b4

See more details on using hashes here.

File details

Details for the file filecache-0.64.win32.zip.

File metadata

  • Download URL: filecache-0.64.win32.zip
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for filecache-0.64.win32.zip
Algorithm Hash digest
SHA256 40c3ecf833e9e5e523b0c40843e2a39e3c2bdce45426a8731608ddeb9c3fc03c
MD5 14d678787a626fc09a705402285d51d3
BLAKE2b-256 78a3c2f9dfefb9e55160f7e2ff8391ee225da2df6c1a4466bffa21266b330db3

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