fcache is a simple, persistent, file-based cache module for Python. It uses cPickle 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.
>>> 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.
>>> 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.
>>> 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.
>>> 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.
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.
fcache uses its GitHub Issues page to track bugs, feature requests, and support questions.
fcache is released under the OSI-approved MIT License. See the file LICENSE.txt for more information.
1 year, 4 months ago passed
.. image:: http://readthedocs.org/projects/fcache/badge/?version=stable :target: https://fcache.readthedocs.io/en/stable/?badge=stable :alt: Documentation Status
<a href='https://fcache.readthedocs.io/en/stable/?badge=stable'> <img src='http://readthedocs.org/projects/fcache/badge/?version=stable' alt='Documentation Status' /> </a>
Project Privacy Level