Take cachename and appname, then create a cache file. If a matching cache file was found, a new one is not created.
appauthor is used on Windows to determine the appropriate cache directory. If not provided, it defaults to appname. See appdirs‘s documentation for more information.
Parameters: |
---|
The cache’s name, as passed to the Cache constructor method. This attribute’s value should not be changed unless you have good reason to do so.
The cache’s parent directory, as determined by appdirs.user_cache_dir(). This attribute’s value should not be changed unless you have good reason to do so.
The cache’s filename. It’s formed by passing cachename to hashlib‘s sha1() constructor. This attribute’s value should not be changed unless you have good reason to do so. Editing it, then getting/setting data will most likely result in errors or lost data.
Store data in the cache. The data, value, is stored under the name, key, in the cache. The data must be picklable. Optionally, the data can expire after timeout seconds have passed.
Parameters: | |
---|---|
Raises: |
|
Get data from the cache. All data stored under the name, key, is returned. If the data is expired, None is returned. Expired data is returned if override is True.
Parameters: | |
---|---|
Returns: | the requested data or None if the requested data has expired. |
Raises: |
|
Force data to expire. After forcing key to expire, calling get() on key will return None.
Parameters: | key (string) – the name of the data to invalidate. |
---|---|
Raises: |
|
Remove data from the cache. All data stored under key is deleted from the cache.
Parameters: | key (string) – the name of the data to remove. |
---|---|
Raises: |
|
Clear all data from the cache. This removes all key/value pairs from the cache.
Raises exceptions.IOError: | |
---|---|
the cache file does not exist. |
Delete the cache file.
On Windows, if the file is in use by another application, an exception is raised. See os.remove() for more information.
Raises exceptions.OSError: | |
---|---|
the cache file does not exist. |