dealnews / caching
Caching PHP Library (Memcache, Redis, etc.)
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 1
pkg:composer/dealnews/caching
Requires
- php: ^8.2
- dealnews/get-config: ^2.1
- predis/predis: ^3.2
Requires (Dev)
This package is auto-updated.
Last update: 2025-10-09 13:34:45 UTC
README
This library provides a standard caching interface and provides classes for Memcached and Redis which implement the interface. We created this because we were moving between different caching services and wanted a unified interface.
Todo
- Add PSR-6 and/or PSR-16 compatible classes
Example
; config.ini in your app base directory [caching.memcache] caching.memcache.app.servers = 10.0.0.1:11211,10.0.0.2:11211 [caching.redis] caching.redis.sessions.servers = 10.0.0.3,10.0.0.4 ; supports redis auth and other options that the ; predis/predis library supports such as sentinel replication caching.redis.sessions.username = someuser caching.redis.sessions.password = XXXXXXXX
<?php $cache = \DealNews\Caching\Cache::factory("app"); $value = $cache->get("somekey"); $cache->set("somekey", 1); $cache->delete("somekey");