oat-sa / lib-health-check-cache
OAT Cache Health Check Library
Installs: 9 582
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 42
Forks: 0
Open Issues: 1
Requires
- php: ^7.4 || ^8
- oat-sa/lib-health-check: ^1.0
- psr/cache: ^1.0 | ^2.0 | ^3.0
- ramsey/uuid: ^4.1
Requires (Dev)
- php-coveralls/php-coveralls: ^2.4
- phpunit/phpunit: ^9.5
This package is not auto-updated.
Last update: 2024-11-17 05:11:09 UTC
README
PSR-6 cache health checker for the Health checks PHP library
Table of contents
Installation
$ composer require oat-sa/lib-health-check-cache
Usage
This library provides a CacheChecker checker in charge to check if the provided cache pool is reachable.
<?php declare(strict_types=1); use OAT\Library\HealthCheck\HealthChecker; use OAT\Library\HealthCheckCache\CacheChecker; use Psr\Cache\CacheItemPoolInterface; $healthChecker = new HealthChecker(); /** @var CacheItemPoolInterface $cache */ $cacheChecker = new CacheChecker($cache); $results = $healthChecker ->registerChecker($cacheChecker) ->performChecks();
Note: The built-in UuidCacheKeyGenerator can accept a custom prefix. If not provided, a default prefix will be used.
Note: If you need a custom logic to generate the cache key, create your own key generator by implementing CacheKeyGeneratorInterface Make sure your generated key is unique enough.
Tests
To run tests:
$ vendor/bin/phpunit
Note: see phpunit.xml.dist for available test suites.