pypicloud.cache.redis_cache module

Store package data in redis

class pypicloud.cache.redis_cache.RedisCache(request=None, db=None, graceful_reload=False, **kwargs)[source]

Bases: ICache

Caching database that uses redis

all(name)[source]

Search for all versions of a package

Parameters
namestr

The name of the package

Returns
packageslist

List of all Package s with the given name

check_health()[source]

Check the health of the cache backend

Returns
(healthy, status)(bool, str)

Tuple that describes the health status and provides an optional status message

clear(package)[source]

Remove this package from the caching database

Parameters
packagePackage
clear_all()[source]

Clear all cached packages from the database

classmethod configure(settings)[source]

Configure the cache method with app settings

distinct()[source]

Get all distinct package names

Returns
nameslist

List of package names

fetch(filename)[source]

Get matching package if it exists

Parameters
filenamestr

Name of the package file

Returns
packagePackage
redis_filename_set(name)[source]

Get the key to a redis set of filenames for a package

redis_key(key)[source]

Get the key to a redis hash that stores a package

redis_prefix = 'pypicloud:'[source]
property redis_set[source]

Get the key to the redis set of package names

redis_summary_key(name)[source]

Get the redis key to a summary for a package

reload_from_storage(clear=True)[source]

Make sure local database is populated with packages

save(package, pipe=None, save_summary=True)[source]

Save this package to the database

Parameters
packagePackage
summary()[source]

Summarize package metadata

Returns
packageslist

List of package dicts, each of which contains ‘name’, ‘summary’, and ‘last_modified’.

pypicloud.cache.redis_cache.summary_from_package(package)[source]

Create a summary dict from a package