banker/src/Driver/DriverInterface.php

89 lines
1.6 KiB
PHP
Raw Normal View History

2016-08-31 12:18:46 -04:00
<?php
/**
2016-09-05 16:43:37 -04:00
* Banker
2016-08-31 12:18:46 -04:00
*
* A Caching library implementing psr/cache
*
* PHP version 5.6
*
2016-09-05 16:43:37 -04:00
* @package Banker
2016-08-31 12:18:46 -04:00
* @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2016 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0.0
2016-09-05 16:43:37 -04:00
* @link https://git.timshomepage.net/timw4mail/banker
2016-08-31 12:18:46 -04:00
*/
namespace Aviat\Banker\Driver;
/**
* Interface for different cache backends
*/
interface DriverInterface {
2016-09-05 16:43:37 -04:00
2016-08-31 12:18:46 -04:00
/**
2016-09-05 16:43:37 -04:00
* See if a key exists in the cache
2016-08-31 12:18:46 -04:00
*
2016-09-05 16:43:37 -04:00
* @param $key
* @return bool
*/
public function exists($key);
/**
* Set a cached value
2016-08-31 12:18:46 -04:00
*
* @param string $key
2016-09-05 16:43:37 -04:00
* @param mixed $value
* @param int $expires
* @return DriverInterface
*/
public function set($key, $value, $expires = 0);
/**
* Get the value for the selected cache key
2016-08-31 12:18:46 -04:00
*
2016-09-05 16:43:37 -04:00
* @param string $key
* @return mixed
*/
public function get($key);
/**
* Retrieve a set of values by their cache key
2016-08-31 12:18:46 -04:00
*
2016-09-05 16:43:37 -04:00
* @param string[] $keys
* @return array
2016-08-31 12:18:46 -04:00
*/
2016-09-05 16:43:37 -04:00
public function getMultiple(array $keys = []);
2016-08-31 12:18:46 -04:00
2016-09-05 16:43:37 -04:00
/**
* Remove an item from the cache
*
* @param string $key
* @return boolean
*/
public function delete($key);
2016-08-31 12:18:46 -04:00
2016-09-05 16:43:37 -04:00
/**
* Remove multiple items from the cache
*
* @param string[] $keys
* @return boolean
*/
public function deleteMultiple(array $keys = []);
/**
* Empty the cache
*
* @return boolean
*/
public function flush();
2016-09-06 17:03:43 -04:00
/**
* Set the specified key to expire at the given time
*
* @param string $key
* @param int $expires
* @return boolean
*/
public function expiresAt($key, $expires);
2016-08-31 12:18:46 -04:00
}