Update README with simple usage example
Some checks failed
Gitea - aviat/banker/pipeline/head There was a failure building this commit
Some checks failed
Gitea - aviat/banker/pipeline/head There was a failure building this commit
This commit is contained in:
parent
1853119188
commit
f939e46c85
28
README.md
28
README.md
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user