* @copyright 2016 - 2017 Timothy J. Warren * @license http://www.opensource.org/licenses/mit-license.html MIT License * @version 1.0.1 * @link https://git.timshomepage.net/timw4mail/banker */ namespace Aviat\Banker\Driver; use Aviat\Banker\LoggerTrait; use Psr\Log\LoggerAwareInterface; /** * Base class for cache backends */ abstract class AbstractDriver implements DriverInterface, LoggerAwareInterface { use LoggerTrait; /** * Data to be stored later * * @var array */ protected $deferred = []; /** * Common constructor interface for driver classes * * @param array $config - Connection parameters for the specified backend * @param array $options - Special connection options for the specified backend */ abstract public function __construct(array $config = [], array $options = []); /** * 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; } }