Source of file BlackHole.php
Size: 10,232 Bytes - Last Modified: 2014-03-12T23:21:18+01:00
/home/theseer/Downloads/ZendFramework-2.3.0/library/Zend/Cache/Storage/Adapter/BlackHole.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503 | <?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace Zend\Cache\Storage\Adapter; use stdClass; use Zend\Cache\Storage\AvailableSpaceCapableInterface; use Zend\Cache\Storage\Capabilities; use Zend\Cache\Storage\ClearByNamespaceInterface; use Zend\Cache\Storage\ClearByPrefixInterface; use Zend\Cache\Storage\ClearExpiredInterface; use Zend\Cache\Storage\FlushableInterface; use Zend\Cache\Storage\IterableInterface; use Zend\Cache\Storage\OptimizableInterface; use Zend\Cache\Storage\StorageInterface; use Zend\Cache\Storage\TaggableInterface; use Zend\Cache\Storage\TotalSpaceCapableInterface; class BlackHole implements StorageInterface, AvailableSpaceCapableInterface, ClearByNamespaceInterface, ClearByPrefixInterface, ClearExpiredInterface, FlushableInterface, IterableInterface, OptimizableInterface, TaggableInterface, TotalSpaceCapableInterface { /** * Capabilities of this adapter * * @var null|Capabilities */ protected $capabilities = null; /** * Marker to change capabilities * * @var null|object */ protected $capabilityMarker; /** * options * * @var null|AdapterOptions */ protected $options; /** * Constructor * * @param null|array|Traversable|AdapterOptions $options */ public function __construct($options = null) { if ($options) { $this->setOptions($options); } } /** * Set options. * * @param array|Traversable|Adapter\AdapterOptions $options * @return StorageInterface Fluent interface */ public function setOptions($options) { if ($this->options !== $options) { if (!$options instanceof AdapterOptions) { $options = new AdapterOptions($options); } if ($this->options) { $this->options->setAdapter(null); } $options->setAdapter($this); $this->options = $options; } return $this; } /** * Get options * * @return Adapter\AdapterOptions */ public function getOptions() { if (!$this->options) { $this->setOptions(new AdapterOptions()); } return $this->options; } /** * Get an item. * * @param string $key * @param bool $success * @param mixed $casToken * @return mixed Data on success, null on failure */ public function getItem($key, & $success = null, & $casToken = null) { $success = false; return null; } /** * Get multiple items. * * @param array $keys * @return array Associative array of keys and values */ public function getItems(array $keys) { return array(); } /** * Test if an item exists. * * @param string $key * @return bool */ public function hasItem($key) { return false; } /** * Test multiple items. * * @param array $keys * @return array Array of found keys */ public function hasItems(array $keys) { return array(); } /** * Get metadata of an item. * * @param string $key * @return array|bool Metadata on success, false on failure */ public function getMetadata($key) { return false; } /** * Get multiple metadata * * @param array $keys * @return array Associative array of keys and metadata */ public function getMetadatas(array $keys) { return array(); } /** * Store an item. * * @param string $key * @param mixed $value * @return bool */ public function setItem($key, $value) { return false; } /** * Store multiple items. * * @param array $keyValuePairs * @return array Array of not stored keys */ public function setItems(array $keyValuePairs) { return array_keys($keyValuePairs); } /** * Add an item. * * @param string $key * @param mixed $value * @return bool */ public function addItem($key, $value) { return false; } /** * Add multiple items. * * @param array $keyValuePairs * @return array Array of not stored keys */ public function addItems(array $keyValuePairs) { return array_keys($keyValuePairs); } /** * Replace an existing item. * * @param string $key * @param mixed $value * @return bool */ public function replaceItem($key, $value) { return false; } /** * Replace multiple existing items. * * @param array $keyValuePairs * @return array Array of not stored keys */ public function replaceItems(array $keyValuePairs) { return array_keys($keyValuePairs); } /** * Set an item only if token matches * * It uses the token received from getItem() to check if the item has * changed before overwriting it. * * @param mixed $token * @param string $key * @param mixed $value * @return bool */ public function checkAndSetItem($token, $key, $value) { return false; } /** * Reset lifetime of an item * * @param string $key * @return bool */ public function touchItem($key) { return false; } /** * Reset lifetime of multiple items. * * @param array $keys * @return array Array of not updated keys */ public function touchItems(array $keys) { return $keys; } /** * Remove an item. * * @param string $key * @return bool */ public function removeItem($key) { return false; } /** * Remove multiple items. * * @param array $keys * @return array Array of not removed keys */ public function removeItems(array $keys) { return $keys; } /** * Increment an item. * * @param string $key * @param int $value * @return int|bool The new value on success, false on failure */ public function incrementItem($key, $value) { return false; } /** * Increment multiple items. * * @param array $keyValuePairs * @return array Associative array of keys and new values */ public function incrementItems(array $keyValuePairs) { return array(); } /** * Decrement an item. * * @param string $key * @param int $value * @return int|bool The new value on success, false on failure */ public function decrementItem($key, $value) { return false; } /** * Decrement multiple items. * * @param array $keyValuePairs * @return array Associative array of keys and new values */ public function decrementItems(array $keyValuePairs) { return array(); } /** * Capabilities of this storage * * @return Capabilities */ public function getCapabilities() { if ($this->capabilities === null) { // use default capabilities only $this->capabilityMarker = new stdClass(); $this->capabilities = new Capabilities($this, $this->capabilityMarker); } return $this->capabilities; } /* AvailableSpaceCapableInterface */ /** * Get available space in bytes * * @return int|float */ public function getAvailableSpace() { return 0; } /* ClearByNamespaceInterface */ /** * Remove items of given namespace * * @param string $namespace * @return bool */ public function clearByNamespace($namespace) { return false; } /* ClearByPrefixInterface */ /** * Remove items matching given prefix * * @param string $prefix * @return bool */ public function clearByPrefix($prefix) { return false; } /* ClearExpiredInterface */ /** * Remove expired items * * @return bool */ public function clearExpired() { return false; } /* FlushableInterface */ /** * Flush the whole storage * * @return bool */ public function flush() { return false; } /* IterableInterface */ /** * Get the storage iterator * * @return KeyIterator */ public function getIterator() { return new KeyListIterator($this, array()); } /* OptimizableInterface */ /** * Optimize the storage * * @return bool */ public function optimize() { return false; } /* TaggableInterface */ /** * Set tags to an item by given key. * An empty array will remove all tags. * * @param string $key * @param string[] $tags * @return bool */ public function setTags($key, array $tags) { return false; } /** * Get tags of an item by given key * * @param string $key * @return string[]|FALSE */ public function getTags($key) { return false; } /** * Remove items matching given tags. * * If $disjunction only one of the given tags must match * else all given tags must match. * * @param string[] $tags * @param bool $disjunction * @return bool */ public function clearByTags(array $tags, $disjunction = false) { return false; } /* TotalSpaceCapableInterface */ /** * Get total space in bytes * * @return int|float */ public function getTotalSpace() { return 0; } } |