gitmyhub

nextcloud-objectstore-cache

PHP ★ 1 updated 2d ago

A drop-in Nextcloud wrapper that adds read caching and automatic retries around S3-style object storage, so unreliable backends like Hetzner Object Storage stay usable as primary file storage.

PHPNextcloudRedisS3

This project is a small add-on for Nextcloud, an open source file sync and sharing platform, that makes it more reliable when Nextcloud stores files in an S3 style object store such as Hetzner Object Storage. It solves a specific problem: object stores sometimes reject requests during traffic bursts, and Nextcloud's built in way of reading files has no retry logic and no caching, so a single rejected request causes a failure for the user.

The wrapper adds three things on top of Nextcloud's normal storage reading. First, it automatically retries reads that fail because of a temporary error, waiting a little longer between each attempt, while still failing quickly for files that are genuinely missing. Second, it keeps a copy of small files, such as note contents and encryption keys, in a fast shared cache called Redis, so repeated reads of the same small file are served almost instantly instead of going back to the object store each time. Third, if a read fails but a cached copy still exists and has not expired, that cached copy is served instead of showing an error to the user, so temporary outages are less disruptive.

Installing it does not require changing any of Nextcloud's own code. Instead, an administrator copies a small app folder onto the server, loads one configuration file that registers the new class, and then changes a single line in Nextcloud's config file so it uses this wrapper instead of the default storage class. Rolling back is just as simple: change that one line back and restart the server process.

Because the wrapper only depends on Nextcloud's public storage interfaces rather than its internal code, it keeps working across Nextcloud version upgrades, which normally replace core files but leave custom app folders and configuration untouched. The project includes automated tests and a set of quality checks that can run through Docker without needing a live Nextcloud installation.

Where it fits