Introduction

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.

Prerequisites

fcache requires the appdirs module to work. appdirs is automatically installed using any of the installation methods listed below.

Installation

There are multiple ways to install fcache. If you are confused about which method to use, try using pip.

Tarball Release

  1. Download the most recent release from fcache’s PyPi page.
  2. Unpack the tarball.
  3. From inside the fcache-0.X directory, run python setup.py install

This will install fcache in your Python’s site-packages directory.

Install the Development Version

fcache’s code is hosted at GitHub. To install the development version, do the following:

  1. Make sure Git is installed. Test if it’s installed by running git --version
  2. git clone git://github.com/tsroten/fcache.git
  3. pip install -e fcache

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())"

Basic Usage

>>> 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.

Table Of Contents

Previous topic

Welcome to fcache!

Next topic

Usage

This Page