Skip to content

Instantly share code, notes, and snippets.

@guilhermeblanco
Created October 14, 2013 19:13
Show Gist options
  • Save guilhermeblanco/6980498 to your computer and use it in GitHub Desktop.
Save guilhermeblanco/6980498 to your computer and use it in GitHub Desktop.
PSR-6: Simple Cache
<?php
namespace Psr\Cache;
interface CacheInterface extends \ArrayAccess
{
/**
* Retrieve a Cache Entry.
*
* @param string $key
*
* @return EntryInterface
*/
public function get($key);
/**
* Define a Cache Entry.
*
* @param EntryInterface $entry
*
* @return boolean
*/
public function set(EntryInterface $entry);
/**
* Remove a Cache Entry.
*
* @param string $key
*
* @return boolean
*/
public function unset($key);
/**
* Check existance of a Cache Entry.
*
* @param string $key
*
* @return boolean
*/
public function isset($key);
}
<?php
namespace Psr\Cache;
interface EntryInterface
{
/**
* Retrieve the Cache Entry key.
*
* @return string
*/
public function getKey();
/**
* Define the Cache Entry key.
*
* @param string $key
*/
public function setKey($key);
/**
* Retrieve the Cache Entry value.
*/
public function getValue();
/**
* Define the Cache Entry value.
*
* @param string $value
*/
public function setValue($value);
/**
* Check if Cache Entry is stored.
*
* @return boolean
*/
public function isStored();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment