Search by

pardnchiu / cache

pardnchiu

This package is abandoned and no longer maintained. No replacement package was suggested.

PD\Cache is a hybrid caching system for PHP that combines Redis and filesystem caching with automatic filesystem fallback support.

1.0.0 2025-02-02 21:04 UTC

This package is auto-updated.

Last update: 2026-10-25 07:46:03 UTC


README

Last updated: 2026-10-25

Note

This README was generated by SKILL, get the ZH version from here.

REDIS WHEN IT'S UP, FILES WHEN IT'S DOWN!

Packagist License

A PHP cache library with Redis-first storage, automatic filesystem fallback, and built-in HTML minification

Table of Contents

Features

composer require pardnchiu/cache · Documentation

  • Redis First, Files as Fallback — Reads and writes go to Redis while it is connected and switch to JSON files under the document root when it is not, so caching never stops.
  • Built-in Expiration — File entries store their expiry time and are deleted on read once stale, while Redis entries rely on EXPIRE.
  • HTML Minification on Write — Line breaks, indentation, and whitespace between tags are stripped to shrink page caches.
  • MD5 Key Normalization — Any page identifier hashes into a fixed-length key, avoiding special-character issues in filenames and key names.
  • One-Call Cleanup — A single method scans the cache directory and removes every expired entry, ready for a cron job.

Architecture

Full Architecture

graph TB
    A[Caller] --> B[PD\Cache]
    B --> C{Redis connected?}
    C -->|Yes| D[Redis DB 1]
    C -->|No| E[storage/caches JSON files]
    E --> F[Expiry check / cleanup]
Loading

License

This project is licensed under the MIT LICENSE.

Author

Just open an issue to share an idea.

php-cache-fallback contributors

©️ 2024 邱敬幃 Pardn Chiu