Start of interface for caching backend
This commit is contained in:
parent
510211cfd0
commit
5aa8a70b0b
36
src/Aviat/Ion/Cache/CacheDriverInterface.php
Normal file
36
src/Aviat/Ion/Cache/CacheDriverInterface.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Ion
|
||||||
|
*
|
||||||
|
* Building blocks for web development
|
||||||
|
*
|
||||||
|
* @package Ion
|
||||||
|
* @author Timothy J. Warren
|
||||||
|
* @copyright Copyright (c) 2015 - 2016
|
||||||
|
* @license MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Aviat\Ion\Cache;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for cache drivers
|
||||||
|
*/
|
||||||
|
interface CacheDriverInterface {
|
||||||
|
/**
|
||||||
|
* Retreive a value from the cache backend
|
||||||
|
*
|
||||||
|
* @param string $key
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function get($key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a cached value
|
||||||
|
*
|
||||||
|
* @param string $key
|
||||||
|
* @param mixed $value
|
||||||
|
* @return CacheDriverInterface
|
||||||
|
*/
|
||||||
|
public function set($key, $value);
|
||||||
|
}
|
||||||
|
// End of CacheDriverInterface.php
|
31
src/Aviat/Ion/Cache/CacheInterface.php
Normal file
31
src/Aviat/Ion/Cache/CacheInterface.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Ion
|
||||||
|
*
|
||||||
|
* Building blocks for web development
|
||||||
|
*
|
||||||
|
* @package Ion
|
||||||
|
* @author Timothy J. Warren
|
||||||
|
* @copyright Copyright (c) 2015 - 2016
|
||||||
|
* @license MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Aviat\Ion\Cache;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for retrieving values from cache
|
||||||
|
*/
|
||||||
|
interface CacheInterface {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retreive a cached value if it exists, otherwise, get the value
|
||||||
|
* from the passed arguments
|
||||||
|
*
|
||||||
|
* @param object $object - object to retrieve fresh value from
|
||||||
|
* @param string $method - method name to call
|
||||||
|
* @param array $args - the arguments to pass to the retrieval method
|
||||||
|
* @return mixed - the cached or fresh data
|
||||||
|
*/
|
||||||
|
public function get($object, $method, array $args);
|
||||||
|
}
|
||||||
|
// End of CacheInterface.php
|
Loading…
Reference in New Issue
Block a user