├── Changelog.md ├── LICENSE ├── README.md ├── VoidCachePool.php └── composer.json /Changelog.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release. 4 | 5 | ## UNRELEASED 6 | 7 | ## 1.2.0 8 | 9 | * Support for PHP 8.1 10 | * Drop support for PHP < 7.4 11 | * Allow psr/cache: ^1.0 || ^2.0 12 | 13 | ## 1.1.0 14 | 15 | ### Added 16 | 17 | * Support for PHP 8 18 | 19 | ## 1.0.0 20 | 21 | * No changes since 0.4.1. 22 | 23 | ## 0.4.1 24 | 25 | ### Changed 26 | 27 | * We now support cache/hierarchical-cache: ^0.4 28 | 29 | ## 0.4.0 30 | 31 | ### Added 32 | 33 | * Support for the new `TaggableCacheItemPoolInterface`. 34 | * Support for PSR-16 SimpleCache 35 | 36 | ### Changed 37 | 38 | * The behavior of `CacheItem::getTags()` has changed. It will not return the tags stored in the cache storage. 39 | 40 | ### Removed 41 | 42 | * `CacheItem::getExpirationDate()`. Use `CacheItem::getExpirationTimestamp()` 43 | * `CacheItem::getTags()`. Use `CacheItem::getPreviousTags()` 44 | * `CacheItem::addTag()`. Use `CacheItem::setTags()` 45 | 46 | ## 0.3.1 47 | 48 | ### Changed 49 | 50 | * Updated dependencies 51 | 52 | ## 0.3.0 53 | 54 | * No changelog before this version 55 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Aaron Scherer, Tobias Nyholm 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Void PSR-6 Cache pool 2 | [![Gitter](https://badges.gitter.im/php-cache/cache.svg)](https://gitter.im/php-cache/cache?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) 3 | [![Latest Stable Version](https://poser.pugx.org/cache/void-adapter/v/stable)](https://packagist.org/packages/cache/void-adapter) 4 | [![codecov.io](https://codecov.io/github/php-cache/void-adapter/coverage.svg?branch=master)](https://codecov.io/github/php-cache/void-adapter?branch=master) 5 | [![Total Downloads](https://poser.pugx.org/cache/void-adapter/downloads)](https://packagist.org/packages/cache/void-adapter) 6 | [![Monthly Downloads](https://poser.pugx.org/cache/void-adapter/d/monthly.png)](https://packagist.org/packages/cache/void-adapter) 7 | [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) 8 | 9 | This is a void implementation of a PSR-6 cache. Other names for this adapter could be Blackhole or Null apdapter. 10 | This adapter does not save anything and will always return an empty CacheItem. It is a part of the PHP Cache 11 | organisation. To read about features like tagging and hierarchy support please read the 12 | shared documentation at [www.php-cache.com](http://www.php-cache.com). 13 | 14 | ### Install 15 | 16 | ```bash 17 | composer require cache/void-adapter 18 | ``` 19 | 20 | ### Use 21 | 22 | You do not need to do any configuration to use the `VoidCachePool`. 23 | 24 | ```php 25 | $pool = new VoidCachePool(); 26 | ``` 27 | 28 | ### Contribute 29 | 30 | Contributions are very welcome! Send a pull request to the [main repository](https://github.com/php-cache/cache) or 31 | report any issues you find on the [issue tracker](http://issues.php-cache.com). 32 | -------------------------------------------------------------------------------- /VoidCachePool.php: -------------------------------------------------------------------------------- 1 | , Tobias Nyholm 7 | * 8 | * This source file is subject to the MIT license that is bundled 9 | * with this source code in the file LICENSE. 10 | */ 11 | 12 | namespace Cache\Adapter\Void; 13 | 14 | use Cache\Adapter\Common\AbstractCachePool; 15 | use Cache\Adapter\Common\PhpCacheItem; 16 | use Cache\Hierarchy\HierarchicalPoolInterface; 17 | 18 | /** 19 | * @author Tobias Nyholm 20 | */ 21 | class VoidCachePool extends AbstractCachePool implements HierarchicalPoolInterface 22 | { 23 | /** 24 | * {@inheritdoc} 25 | */ 26 | protected function fetchObjectFromCache($key) 27 | { 28 | return [false, null, [], null]; 29 | } 30 | 31 | /** 32 | * {@inheritdoc} 33 | */ 34 | protected function clearAllObjectsFromCache() 35 | { 36 | return true; 37 | } 38 | 39 | /** 40 | * {@inheritdoc} 41 | */ 42 | protected function clearOneObjectFromCache($key) 43 | { 44 | return true; 45 | } 46 | 47 | /** 48 | * {@inheritdoc} 49 | */ 50 | protected function storeItemInCache(PhpCacheItem $item, $ttl) 51 | { 52 | return true; 53 | } 54 | 55 | /** 56 | * {@inheritdoc} 57 | */ 58 | public function clearTags(array $tags) 59 | { 60 | return true; 61 | } 62 | 63 | protected function getList($name) 64 | { 65 | return []; 66 | } 67 | 68 | protected function removeList($name) 69 | { 70 | return true; 71 | } 72 | 73 | protected function appendListItem($name, $key) 74 | { 75 | } 76 | 77 | protected function removeListItem($name, $key) 78 | { 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cache/void-adapter", 3 | "description": "A PSR-6 cache implementation using Void. This implementation supports tags", 4 | "license": "MIT", 5 | "type": "library", 6 | "keywords": [ 7 | "cache", 8 | "psr-6", 9 | "void", 10 | "tag" 11 | ], 12 | "authors": [ 13 | { 14 | "name": "Aaron Scherer", 15 | "email": "aequasi@gmail.com", 16 | "homepage": "https://github.com/aequasi" 17 | }, 18 | { 19 | "name": "Tobias Nyholm", 20 | "email": "tobias.nyholm@gmail.com", 21 | "homepage": "https://github.com/nyholm" 22 | } 23 | ], 24 | "homepage": "http://www.php-cache.com/en/latest/", 25 | "require": { 26 | "php": ">=7.4", 27 | "cache/adapter-common": "^1.0", 28 | "cache/hierarchical-cache": "^1.0", 29 | "psr/cache": "^1.0 || ^2.0", 30 | "psr/simple-cache": "^1.0" 31 | }, 32 | "require-dev": { 33 | "cache/integration-tests": "^0.17", 34 | "phpunit/phpunit": "^7.5.20 || ^9.5.10" 35 | }, 36 | "provide": { 37 | "psr/cache-implementation": "^1.0", 38 | "psr/simple-cache-implementation": "^1.0" 39 | }, 40 | "minimum-stability": "dev", 41 | "prefer-stable": true, 42 | "autoload": { 43 | "psr-4": { 44 | "Cache\\Adapter\\Void\\": "" 45 | }, 46 | "exclude-from-classmap": [ 47 | "/Tests/" 48 | ] 49 | }, 50 | "extra": { 51 | "branch-alias": { 52 | "dev-master": "1.1-dev" 53 | } 54 | } 55 | } 56 | --------------------------------------------------------------------------------