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

This commit is contained in:
Timothy Warren 2020-05-07 19:43:01 -04:00
parent 1853119188
commit f939e46c85
1 changed files with 20 additions and 8 deletions

View File

@ -1,10 +1,6 @@
# Banker
A Caching library implementing the PSR-6 interface for several common cache
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)
A Caching library implementing the PSR-6 and PSR-16 interfaces for several common cache backends
## Cache Backends
* Apcu
@ -12,7 +8,23 @@ backends
* Redis
* 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
// Create the pool
@ -38,8 +50,8 @@ else
#### Configuration / Connection array
The config array passed to the Pool class constructor determines
which server to connect to. Regardless of the backend, the basic
The config array passed to the Pool class constructor determines
which server to connect to. Regardless of the backend, the basic
structure is like so:
```php