This is the documentation for fcache. fcache is a Python module that provides a simple, persistent, file-based cache. Cached dated can optionally expire after a certain amount of time.
fcache requires the appdirs module to work. appdirs is automatically installed using any of the installation methods listed below.
There are multiple ways to install fcache. If you are confused about which method to use, try using pip.
pip is a tool for installing and managing Python packages. To install fcache, run:
$ pip install fcache
This will download fcache from the Python Package Index and install it in your Python’s site-packages directory.
This will install fcache in your Python’s site-packages directory.
fcache’s code is hosted at GitHub. To install the development version, do the following:
This will link the fcache directory into your site-packages directory. You can find out where your site-packages directory is by running:
python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
>>> import fcache
>>> cache = fcache.Cache("population", "statistics-fetcher")
>>> cache.set("chicago", 9729825)
>>> print cache.get("chicago")
9729825
This code creates the cache population for the application statistics-fetcher. Then, it sets the key chicago to the value 9729825. Next, it prints the value of chicago.