Last updated: 2026-10-25
REDIS DOWN? YOUR APP KEEPS RUNNING!
A PHP Redis client with persistent connections, per-call database selection, and failure-safe default returns
composer require pardnchiu/redis-cli· Documentation
- Connection Failures Never Crash — Connect or auth failures only reach error_log, and every method returns a safe default such as false, an empty array, or 0 so callers can degrade.
- Persistent Connections, Lazy Reconnect — pconnect reuses connections to cut handshake cost, and after a failed first connect every call tries to connect again.
- Per-Call Database Selection — The first argument of every method is the DB index, so one instance works across multiple logical databases.
- TTL on Write — Write methods for strings, hashes, lists, and sets accept an expiry in seconds, removing the extra EXPIRE call.
- Common Data Types Covered — Strings, counters, hashes, lists, set algebra, and batch reads and writes share one consistent method signature.
graph TB
A[Caller] --> B[pardnchiu\RDB]
ENV[REDIS_HOST / PORT / PASSWORD] --> C[getConnection]
B --> C
C -->|OK| D[exec: select db + command]
C -->|Fail| E[Safe default]
D --> F[(Redis)]
This project is licensed under the MIT LICENSE.
Just open an issue to share an idea.
©️ 2024 邱敬幃 Pardn Chiu