Update README with simple usage example
Some checks failed
Gitea - aviat/banker/pipeline/head There was a failure building this commit

This commit is contained in:
Timothy Warren 2020-05-07 19:43:01 -04:00
parent 1853119188
commit f939e46c85

View File

@ -1,10 +1,6 @@
# Banker # Banker
A Caching library implementing the PSR-6 interface for several common cache A Caching library implementing the PSR-6 and PSR-16 interfaces for several common cache backends
backends
[![build status](https://git.timshomepage.net/timw4mail/banker/badges/master/build.svg)](https://git.timshomepage.net/timw4mail/banker/commits/master)
[![coverage report](https://git.timshomepage.net/timw4mail/banker/badges/master/coverage.svg)](https://git.timshomepage.net/timw4mail/banker/commits/master)
## Cache Backends ## Cache Backends
* Apcu * Apcu
@ -12,7 +8,23 @@ backends
* Redis * Redis
* Null - no persistence * Null - no persistence
### Basic Usage ### Basic Usage (SimpleCache/PSR-16)
```php
<?php
// $config is the configuration array
// $logger is an optional psr/log compatible logger
$cache = new Aviat\Banker\Teller($config, $logger);
// Get a value from the cache, returning $defaultValue
// if the value doesn't exist in the cache
$value = $cache->get($key, $defaultValue);
// Save a new value at the specified key
$saved = $cache->set($key, 'newValue');
```
### Basic Usage (Pool/PSR-6)
```php ```php
<?php <?php
// Create the pool // Create the pool