Download the PHP package monkeyscloud/monkeyslegion-cache without Composer
On this page you can find all versions of the php package monkeyscloud/monkeyslegion-cache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download monkeyscloud/monkeyslegion-cache
More information about monkeyscloud/monkeyslegion-cache
Files in monkeyscloud/monkeyslegion-cache
Package monkeyslegion-cache
Short Description High-performance cache package for MonkeysLegion Framework with multiple drivers, atomic locks, encrypted serialization, and tiered caching
License MIT
Informations about the package monkeyslegion-cache
MonkeysLegion Cache v2
High-performance, attribute-driven cache package for PHP 8.4+ with multiple drivers, atomic locks, encrypted serialization, tiered caching, and stampede protection.
Installation
Features
| Feature | Description |
|---|---|
| 6 Drivers | Array, File, Redis, Memcached, Null, Chain (L1/L2) |
| Pluggable Serializers | PHP, JSON, igbinary, Encrypted (libsodium) |
| Atomic Locks | ArrayLock, FileLock, RedisLock |
| Tag-Based Invalidation | O(1) version-based tag invalidation |
| Stampede Protection | flexible() with probabilistic early expiration |
| Typed Getters | integer(), boolean(), float(), string(), array() |
| TTL Extension | touch() — extend TTL without re-reading value |
| Cache Events | Hit, Miss, Write, Delete — readonly event VOs |
| PSR-16 Compliant | Full Psr\SimpleCache\CacheInterface conformance |
| PHP 8.4 Native | Property hooks, asymmetric visibility, backed enums |
Quick Start
Typed Getters
No more manual casting:
Remember & Stampede Protection
Tags
O(1) tag invalidation using version-based namespacing:
Atomic Locks
Prevent race conditions with distributed locks:
Lock Backends
| Lock | Use Case |
|---|---|
ArrayLock |
Testing, single-process |
FileLock |
Single-server production |
RedisLock |
Multi-server distributed (Lua-based atomic release) |
Chain Store (L1/L2 Tiered Caching)
Encrypted Serialization
Transparent at-rest encryption for GDPR/PCI compliance:
TTL Extension (touch)
Extend cache TTL without re-reading the value (single round-trip on Redis):
Cache Events
Readonly event value objects for telemetry/debugging:
CacheEntry Value Object
Introspect cached data with computed properties:
Cache Stats
Pluggable Serializers
| Serializer | Best For |
|---|---|
PhpSerializer |
Default, supports all PHP types |
JsonSerializer |
Scalars/arrays, zero code execution risk |
IgbinarySerializer |
30-50% smaller payloads (requires ext-igbinary) |
EncryptedSerializer |
Decorator, transparent at-rest encryption |
Extending with Custom Drivers
PHP 8.4 Features Used
- Property hooks —
CacheEntry,CacheStats,CacheEvent,TaggedCache,ChainStore - Asymmetric visibility —
CacheEntry,CacheLock,CacheEvent - Backed enums —
SerializerType,CacheEventType,LockState newin initializers — DefaultPhpSerializer()in constructorsmatchexpressions — Driver/serializer resolutiondeclare(strict_types=1)— Every file
Testing
98 tests, 190 assertions — covers all stores, serializers, locks, tags, events, enums, and CacheManager.
License
MIT © MonkeysCloud