PHPackages                             kevinpirnie/kpt-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. kevinpirnie/kpt-cache

ActiveLibrary[Caching](/categories/caching)

kevinpirnie/kpt-cache
=====================

Modern Multi-Tier PHP Caching System with automatic tier discovery, connection pooling, and failover support

v1.0.83(3mo ago)098[1 PRs](https://github.com/kpirnie/kp-cache/pulls)1MITPHPPHP &gt;=8.4CI passing

Since Jan 24Pushed 2mo agoCompare

[ Source](https://github.com/kpirnie/kp-cache)[ Packagist](https://packagist.org/packages/kevinpirnie/kpt-cache)[ Docs](https://github.com/kpirnie/kp-cache)[ Fund](https://ko-fi.com/kevinpirnie)[ Fund](https://www.paypal.biz/kevinpirnie)[ RSS](/packages/kevinpirnie-kpt-cache/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (4)Used By (1)

KPT Cache - Modern Multi-Tier Caching System
============================================

[](#kpt-cache---modern-multi-tier-caching-system)

A comprehensive, high-performance caching solution that provides multiple tiers of caching including OPcache, SHMOP, APCu, YAC, Redis, Memcached, SQLite, and File-based caching with automatic tier discovery, connection pooling, and failover support.

✨ Features
----------

[](#-features)

- **🚀 Multi-Tier Architecture**: Automatically discovers and prioritizes cache tiers for optimal performance
- **🔄 Automatic Failover**: Seamlessly falls back to available tiers when primary tiers fail
- **⚡ Connection Pooling**: Efficient connection management for Redis and Memcached
- **🔧 Async Operations**: Promise-based asynchronous cache operations with event loop support
- **🏥 Health Monitoring**: Comprehensive health checks and alerting for all cache tiers
- **🔑 Smart Key Management**: Intelligent key generation with tier-specific limitations handling
- **📊 Statistics &amp; Monitoring**: Detailed performance metrics and usage statistics
- **🛠️ CLI Tools**: Command-line utilities for cache management and cleanup
- **🎯 Zero Configuration**: Works out of the box with sensible defaults
- **🔒 Production Ready**: Battle-tested with comprehensive error handling

🎯 Supported Cache Tiers
-----------------------

[](#-supported-cache-tiers)

TierTypePriorityUse Case**Array**MemoryHighestRequest-level ultra-fast caching**OPcache**MemoryHighPHP opcode and file-based caching**SHMOP**Shared MemoryHighInter-process shared memory**APCu**MemoryHighUser data cache in shared memory**YAC**MemoryHighYet Another Cache extension**Redis**NetworkMediumDistributed caching and sessions**Memcached**NetworkMediumDistributed memory caching**SQLite**DatabaseLowLocal database caching**File**FilesystemLowestFallback file-based caching📦 Installation
--------------

[](#-installation)

### Requirements

[](#requirements)

- PHP 8.1 or higher
- Composer
- At least one cache backend (File system is always available)

### Installation via Composer

[](#installation-via-composer)

```
composer require kevinpirnie/kpt-cache
```

### Optional Extensions

[](#optional-extensions)

For maximum performance, install these PHP extensions:

```
# Redis support
pecl install redis

# Memcached support
pecl install memcached

# APCu support
pecl install apcu

# YAC support
pecl install yac
```

🚀 Quick Start
-------------

[](#-quick-start)

### Basic Usage

[](#basic-usage)

```
