Skip to content

Commit

Permalink
Removed the Cache\Iterator in favor of a standard Iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
tedivm committed Feb 28, 2012
1 parent 122fad1 commit 51cfce4
Showing 1 changed file with 3 additions and 26 deletions.
29 changes: 3 additions & 26 deletions proposed/PSR-Cache.md
Expand Up @@ -52,9 +52,7 @@ All data passed into the Implementing Library must be returned exactly as passed

The main focus of the Cache\Pool object is to accept a key from the Calling Library and return the associated Cache\Item object. The majority of the Pool object's implementation is up to the Implementing Library, including all configuration, initialization and the injection itself into the Calling Library.

Items can be retrieved from the Cache\Pool either individually or as a group operation.

The Cache\IteratorFactory is an extension of the Cache\Factory class which is capable of performing bulk operations. While it can be used for retrieving individual items, it also defines a "getCacheIterator" function which takes an array of keys and returns a Cache\Iterator object.
Items can be retrieved from the Cache\Pool either individually or as a group operation, either by using the getCache or getCacheIterator functions.

```php
namespace PSR\Cache;
Expand All @@ -80,13 +78,13 @@ interface Factory
function getCache($key);

/**
   * Returns a group of cache objects as a Cache\Iterator
   * Returns a group of cache objects as an \Iterator
*
* Bulk lookups can often by steamlined by backend cache systems. The
* returned iterator will contain a Cache\Item for each key passed.
*
    * @param array $key
     * @return PSR\Cache\Iterator
     * @return \Iterator
     */
    function getCacheIterator($keys);

Expand Down Expand Up @@ -189,27 +187,6 @@ interface Item
```


### Cache\Iterator

The Cache\Iterator is a collection of Cache\Item objects. This class allows Calling Libraries to iterate through each cache item, which allows developers to take actions based on the individual status of each item while still letting the Implementing Library utilize bulk operations where appropriate in the back end.


```php
namespace PSR\Cache;

/**
* An iterator of Cache\Items.
*
* The Cache\Iterator provides a way to loop through Cache\Items, particularly
* those returned by bulk operations.
*/
interface Iterator extends \Iterator
{

}
```


## Extensions

Extensions are optional which do not need to be implemented by the Implementing Library but which may provide useful functionality or insights. Calling Libraries should not rely on any of the functionality below, but can use any relevant interfaces. These extensions primarily exist to show how the existing standard can be extending by interested developers while still meeting the guidelines of this standard.
Expand Down

0 comments on commit 51cfce4

Please sign in to comment.