2014-07-19 15:37:48 +02:00
|
|
|
<?php
|
|
|
|
|
2014-07-21 15:12:51 +02:00
|
|
|
namespace Addr;
|
2014-07-19 15:37:48 +02:00
|
|
|
|
2014-07-21 18:48:36 +02:00
|
|
|
interface Cache
|
|
|
|
{
|
2014-07-19 15:37:48 +02:00
|
|
|
/**
|
|
|
|
* Attempt to retrieve a value from the cache
|
|
|
|
*
|
|
|
|
* Returns an array [$cacheHit, $value]
|
|
|
|
* [true, $valueFromCache] - if it existed in the cache
|
|
|
|
* [false, null] - if it didn't already exist in the cache
|
|
|
|
*
|
2014-07-21 18:48:36 +02:00
|
|
|
* @param $name
|
2014-07-19 15:37:48 +02:00
|
|
|
* @return array
|
|
|
|
*/
|
2014-07-21 18:48:36 +02:00
|
|
|
public function get($name);
|
2014-07-19 15:37:48 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Stores a value in the cache. Overwrites the previous value if there was one.
|
|
|
|
*
|
2014-07-21 18:48:36 +02:00
|
|
|
* @param $name
|
2014-07-19 15:37:48 +02:00
|
|
|
* @param $value
|
|
|
|
* @param null $ttl
|
|
|
|
*/
|
2014-07-21 18:48:36 +02:00
|
|
|
public function store($name, $value, $ttl = null);
|
|
|
|
|
2014-07-19 15:37:48 +02:00
|
|
|
/**
|
|
|
|
* Deletes an entry from the cache.
|
2014-07-21 18:48:36 +02:00
|
|
|
*
|
|
|
|
* @param $name
|
2014-07-19 15:37:48 +02:00
|
|
|
*/
|
2014-07-21 18:48:36 +02:00
|
|
|
public function delete($name);
|
2014-07-19 15:37:48 +02:00
|
|
|
}
|