PHPackages                             pardnchiu/cache - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. pardnchiu/cache

ActiveLibrary[Caching](/categories/caching)

pardnchiu/cache
===============

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

1.0.0(1y ago)08MITPHPPHP &gt;=8.0

Since Feb 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/pardnchiu/PHP-Cache)[ Packagist](https://packagist.org/packages/pardnchiu/cache)[ RSS](/packages/pardnchiu-cache/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

PD\\Cache
=========

[](#pdcache)

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

[![tag](https://camo.githubusercontent.com/07d4775f9a428b29d7f341b0104590f95096d5f18eba51e4087d9c4d528f99d7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7461672d5048502532304c6962726172792d626234343434)](https://camo.githubusercontent.com/07d4775f9a428b29d7f341b0104590f95096d5f18eba51e4087d9c4d528f99d7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7461672d5048502532304c6962726172792d626234343434)[![size](https://camo.githubusercontent.com/08375934c1440f0f1d13945863813f799de430f25c03a0619a820db6c7797582/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73697a652f706172646e636869752f5048502d43616368652f7372632f43616368652e706870)](https://camo.githubusercontent.com/08375934c1440f0f1d13945863813f799de430f25c03a0619a820db6c7797582/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73697a652f706172646e636869752f5048502d43616368652f7372632f43616368652e706870)
[![version](https://camo.githubusercontent.com/09088694ff189150ed6ba28db510516df5df3effc5778b01c24bfd39bb15e148/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706172646e636869752f6361636865)](https://camo.githubusercontent.com/09088694ff189150ed6ba28db510516df5df3effc5778b01c24bfd39bb15e148/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706172646e636869752f6361636865)[![download](https://camo.githubusercontent.com/da4ca05aaee50aef66634ac65fb225fcb004cd7bbee1a162436b16dceec79fe0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f706172646e636869752f6361636865)](https://camo.githubusercontent.com/da4ca05aaee50aef66634ac65fb225fcb004cd7bbee1a162436b16dceec79fe0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f706172646e636869752f6361636865)

Features
--------

[](#features)

- Hybrid caching strategy (Redis + Filesystem)
- Automatic fallback to filesystem when Redis is unavailable
- Built-in HTML / Text content optimization
- Automatic cache expiration handling
- Cache cleanup mechanism
- MD5 key generation for cache entries

Key Capabilities
----------------

[](#key-capabilities)

- Get/Set cache with automatic storage selection
- HTML/Text content minification
- Automatic cache expiration
- Cache cleanup for expired entries
- System resilience fallback mechanism

Dependencies
------------

[](#dependencies)

- `pardnchiu/redis` - For Redis caching support (optional)
- `/storage/caches` - Write permission on storage directory

How to Use
----------

[](#how-to-use)

### Installation

[](#installation)

```
composer require pardnchiu/cache
```

```
// Initialize cache with Redis support
$redis = new PD\Redis();
$cache = new PD\Cache($redis);

// Set cache with 1-hour expiration
$cache->set("page-key", $content, 3600);

// Get cached content
$content = $cache->get("page-key");

// Clean expired cache entries
$cache->clean();

// Initialize cache without Redis (filesystem only)
$cache = new PD\Cache();
```

License
-------

[](#license)

This source code project is licensed under the [MIT](https://github.com/pardnchiu/PHP-Cache/blob/main/LICENSE) license.

Creator
-------

[](#creator)

[![](https://avatars.githubusercontent.com/u/25631760)](https://avatars.githubusercontent.com/u/25631760)

#### Pardn Chiu

[](#pardn-chiu)

[ ![](https://camo.githubusercontent.com/e4e01ee8def1b738dccf7d9ae9b80b137ddbfb3620b6cd2252a085691d2aa44b/68747470733a2f2f706172646e2e696f2f696d6167652f656d61696c2e737667)](mailto:dev@pardn.io)[ ![](https://camo.githubusercontent.com/3005d0110354f5144ff35f72d9e23c4df3cedf99365160c6c307236e8fc4d189/68747470733a2f2f706172646e2e696f2f696d6167652f6c696e6b6564696e2e737667)](https://linkedin.com/in/pardnchiu)---

©️ 2024 [Pardn Chiu](https://pardn.io)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance42

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

470d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/49e43b8311782f6fedf52a06a0e29d2a85c9e5277f146ec0f2293f3439858b14?d=identicon)[pardnchiu](/maintainers/pardnchiu)

---

Top Contributors

[![pardnchiu](https://avatars.githubusercontent.com/u/25631760?v=4)](https://github.com/pardnchiu "pardnchiu (3 commits)")

---

Tags

cachepardnchiuphp-composerphp-library

### Embed Badge

![Health badge](/badges/pardnchiu-cache/health.svg)

```
[![Health](https://phpackages.com/badges/pardnchiu-cache/health.svg)](https://phpackages.com/packages/pardnchiu-cache)
```

###  Alternatives

[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[wp-media/wp-rocket

Performance optimization plugin for WordPress

7431.3M3](/packages/wp-media-wp-rocket)[illuminate/cache

The Illuminate Cache package.

12835.6M1.4k](/packages/illuminate-cache)[colinmollenhour/php-redis-session-abstract

A Redis-based session handler with optimistic locking

6325.6M14](/packages/colinmollenhour-php-redis-session-abstract)[cheprasov/php-redis-client

Php client for Redis. It is a fast, fully-functional and user-friendly client for Redis, optimized for performance. RedisClient supports the latest versions of Redis starting from 2.6 to 6.0

1281.2M21](/packages/cheprasov-php-redis-client)[amphp/redis

Efficient asynchronous communication with Redis servers, enabling scalable and responsive data storage and retrieval.

165634.7k44](/packages/amphp-redis)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
