banker/src/Driver/AbstractDriver.php

68 lines
1.4 KiB
PHP
Raw Normal View History

2016-10-19 09:57:06 -04:00
<?php declare(strict_types=1);
2016-08-31 12:18:46 -04:00
/**
2016-09-05 16:43:37 -04:00
* Banker
2016-08-31 12:18:46 -04:00
*
* A Caching library implementing psr/cache
*
2016-10-19 09:57:06 -04:00
* PHP version 7.0
2016-08-31 12:18:46 -04:00
*
2016-10-19 09:57:06 -04:00
* @package Banker
* @author Timothy J. Warren <tim@timshomepage.net>
2017-03-01 12:33:12 -05:00
* @copyright 2016 - 2017 Timothy J. Warren
2016-10-19 09:57:06 -04:00
* @license http://www.opensource.org/licenses/mit-license.html MIT License
2017-03-01 12:33:12 -05:00
* @version 1.0.1
2016-10-19 09:57:06 -04:00
* @link https://git.timshomepage.net/timw4mail/banker
2016-08-31 12:18:46 -04:00
*/
namespace Aviat\Banker\Driver;
2017-03-01 13:04:00 -05:00
use Aviat\Banker\LoggerTrait;
2016-09-06 17:03:43 -04:00
use Psr\Log\LoggerAwareInterface;
2016-08-31 12:18:46 -04:00
/**
* Base class for cache backends
*/
2016-09-06 17:03:43 -04:00
abstract class AbstractDriver implements DriverInterface, LoggerAwareInterface {
2016-09-06 20:57:24 -04:00
2017-03-01 13:04:00 -05:00
use LoggerTrait;
2016-09-05 16:43:37 -04:00
/**
* Data to be stored later
*
* @var array
*/
protected $deferred = [];
/**
* Common constructor interface for driver classes
*
* @param array $config - Connection parameters for the specified backend
2016-09-06 20:57:24 -04:00
* @param array $options - Special connection options for the specified backend
2016-09-05 16:43:37 -04:00
*/
2016-09-06 20:57:24 -04:00
abstract public function __construct(array $config = [], array $options = []);
2016-09-06 17:03:43 -04:00
/**
* Common destructor
*/
abstract public function __destruct();
/**
* Retrieve a set of values by their cache key
*
* @param string[] $keys
* @return array
*/
public function getMultiple(array $keys = []): array
{
$output = [];
foreach ($keys as $key)
{
if ($this->exists($key))
{
$output[$key] = $this->get($key);
}
}
return $output;
}
2016-08-31 12:18:46 -04:00
}