Skip to main content

A basic Python package to store files in a LRU cache.

Project description

A tool to provide a LRU cache on files.

It has been created to store gigabytes of Thumbor thumbnails on a DigitalOcean server.


from pycachu import Pycachu

# Initialize the cache
# The dir has to exist
p = Pycachu('/storage/pycachu', 20 * (1024 ** 3))

# Get a file
f = p.get('/some/file')

if f is not None:
    yield f
    content = generate_file_content()
    p.put('/some/file', content)
    yield content


The performance is not exceptional, but operations basically take a constant time independently of the number of files in the cache, which is not too bad.

Rough benchmarking gave about 170 get per second.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pycachu, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size pycachu-0.1.1.tar.gz (3.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page