philippwitzmann / cache
Cache Framework
Installs: 307
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/philippwitzmann/cache
Requires
- php: >=7.2
- philippwitzmann/date-time-handler: ~1.2
- predis/predis: 1.1.1
Requires (Dev)
- mockery/mockery: ^1.1
- philippwitzmann/codingstandard: ~3.0
- philippwitzmann/testing: ~1.0
Suggests
- ext-curl: Allows access to Webdis when paired with phpiredis
- ext-phpiredis: Allows faster serialization and deserialization of the Redis protocol
This package is auto-updated.
Last update: 2025-09-29 02:29:56 UTC
README
This library aims to provide basic functionality to work with (testable, interchangable) Cache implementations
Installation
composer require philippwitzmann/cache
Usage
Create an instance
$dateTimeHandler = new DateTimeHandler(); $arrayCache = new ArrayCache($dateTimeHandler);
Set Values
$client = new Client([ 'scheme' => 'tcp', 'host' => '127.0.0.1', 'port' => 6379, ]); $dateTimeHandler = new DateTimeHandler(); $arrayCache = new ArrayCache($dateTimeHandler); $redisCache = new RedisCache($dateTimeHandler, $client); $arrayCache->set('key', 'value', 600); // 600 is Lifetime In Seconds so 10Minutes. $redisCache->set('key', 'value', 600); // 600 is Lifetime In Seconds so 10Minutes. echo $arrayCache->get('key'); // Outputs: 'value'
Running tests
php vendor/bin/phpunit --configuration config/phpunit.xml