forked from php-fig/fig-standards
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added initial outline and interfaces.
This is the initial outline of the caching proposal, including the interfaces themselves (which are the most fleshed out part of this being added to the repo at the moment).
- Loading branch information
Showing
1 changed file
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
##Introduction | ||
##Goal | ||
##Interface | ||
###CacheFactory | ||
|
||
namespace PSR\Cache; | ||
|
||
interface CacheFactory | ||
{ | ||
|
||
/** | ||
* | ||
* @param string $key | ||
* @return CacheItem | ||
*/ | ||
function getCache($key); | ||
} | ||
|
||
|
||
###CacheItem | ||
|
||
namespace PSR\Cache; | ||
|
||
interface CacheItem | ||
{ | ||
/** | ||
* | ||
* @return mixed | ||
*/ | ||
function get(); | ||
|
||
/** | ||
* | ||
* @param mixed $value | ||
* @param int $ttl | ||
* @return bool | ||
*/ | ||
function set($value, $ttl = null); | ||
|
||
/** | ||
* | ||
* @return bool | ||
*/ | ||
function isMiss(); | ||
|
||
/** | ||
* | ||
* @return mixed | ||
*/ | ||
function clear(); | ||
} | ||
|
||
##Examples | ||
##Extensions | ||
###Namespaces | ||
###Tags | ||
###Drivers | ||
|
||
namespace PSR\Cache; | ||
|
||
interface Driver | ||
{ | ||
/** | ||
* | ||
* @param array $key | ||
* @return array|false | ||
*/ | ||
function retrieve($key); | ||
|
||
/** | ||
* | ||
* @param array $key | ||
* @param array $data | ||
* @param int $expiration | ||
* @return bool | ||
*/ | ||
function store($key, $data, $ttl); | ||
|
||
/** | ||
* | ||
* @param null|array $key | ||
* @return bool | ||
*/ | ||
function clear($key = null); | ||
} |