Skip to main content

a simple, persistent, file-based cache module for Python

Project description

About

fcache is a simple, persistent, file-based cache module for Python. It uses pickle to store objects into a cache file and appdirs to ensure that cache files are stored in platform-appropriate, application-specific directories. It supports optional, time-based data expiration.

It’s Simple

>>> import fcache
>>> cache = fcache.Cache("population", "statistics-fetcher")
>>> cache.set("chicago", 9729825)
>>> print cache.get("chicago")
9729825

Using fcache is as simple as creating a Cache object, setting data, and getting data back.

It’s Persistent

>>> exit()
$ python
>>> import fcache
>>> cache = fcache.Cache("population", "statistics-fetcher")
>>> print cache.get("chicago")
9729825

Cached data doesn’t disappear when you stop using a Cache object. When you create a new object with the same arguments, your data is still there, just like you left it.

It’s File-Based

>>> print cache.filename
/Users/tsr/Library/Caches/statistics-fetcher/248081ecb337c85ec8e4330e6099625a

Cached data is stored in a file, plain and simple. You can see it on the file system. You can delete it, copy it, or write your own library to open it.

It’s Time-Aware

>>> import time
>>> cache.set("chicago", 9729825, 30)
>>> print cache.get("chicago")
9729825
>>> time.sleep(30)
>>> print cache.get("chicago")
None

Just like an orange, some data goes bad after awhile. fcache can keep track of when data should expire.

Documentation

fcache’s documentation contains an introduction along with an API overview. For more information on how to get started with fcache, be sure to read the documentation.

Bug/Issues Tracker

fcache uses its GitHub Issues page to track bugs, feature requests, and support questions.

License

fcache is released under the OSI-approved MIT License. See the file LICENSE.txt for more information.

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

fcache-0.3.1.tar.gz (428.4 kB view details)

Uploaded Source

File details

Details for the file fcache-0.3.1.tar.gz.

File metadata

  • Download URL: fcache-0.3.1.tar.gz
  • Upload date:
  • Size: 428.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for fcache-0.3.1.tar.gz
Algorithm Hash digest
SHA256 12f3d78ad9217522bc7f0589b4e3d70c5f1e91c54420e8f9dc3e6d2e209c3d68
MD5 3c9424f3d9c5511fbcb415c60cfd8b94
BLAKE2b-256 60c83aa8d19fd1060766f929bd3b4ac3688ba9ab315c8ba1b5a52b7c995810ab

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page