keinos / mastodon-streaming-api-cache
Simple Key-Value Store Class.
Installs: 427
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 1
Language:Shell
Requires
- php: ^8.0 || ^7.1
- ext-mbstring: *
- symfony/cache: ^4.4
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.3
- phan/phan: ^3.0 || ^2.5
- php-coveralls/php-coveralls: ^2.2
- phpbench/phpbench: @dev
- phpmd/phpmd: @stable
- phpstan/extension-installer: ^1.0
- phpstan/phpstan: ^0.12.10
- phpunit/phpunit: ^9.0 || ^8.0 || ^7.0 || ^6.5
- psalm/phar: ^3.9
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-11-22 22:04:25 UTC
README
Simple Key-Value Store Class for Caching
This is a simple Key-Value store PHP class for a simple purposes such as caching.
- Notes: Not aimed to use for a simultaneous massive access. This is a wrapper class of symfony/cache component.
Install
composer require keinos/mastodon-streaming-api-cache
Usage
<?php namespace KEINOS\Sample; require_once __DIR__ . '/../vendor/autoload.php'; // Instantiate use KEINOS\MSTDN_TOOLS\Cache\Cache; $cache = new Cache(); // Set value to the cache $key = 'foo'; $value = 'bar'; $cache->set($key, $value); // Get value from the cache $actual = $cache->get($key); $expect = $value; echo ($expect === $actual) ? 'OK' : 'NG', PHP_EOL; // Delete value from the cache $result = $cache->delete($key); // Clear all the caches $result = $cache->clear();