pax_global_header00006660000000000000000000000064152410712160014511gustar00rootroot0000000000000052 comment=8e1319bc156f3402d93795a02d4df829131cd46b tag-interop-2.0.0/000077500000000000000000000000001524107121600137415ustar00rootroot00000000000000tag-interop-2.0.0/.github/000077500000000000000000000000001524107121600153015ustar00rootroot00000000000000tag-interop-2.0.0/.github/PULL_REQUEST_TEMPLATE.md000066400000000000000000000002041524107121600210760ustar00rootroot00000000000000This is a READ ONLY repository. Please make your pull request to https://github.com/php-cache/cache Thank you for contributing. tag-interop-2.0.0/.gitignore000066400000000000000000000000251524107121600157260ustar00rootroot00000000000000composer.lock vendor tag-interop-2.0.0/Changelog.md000066400000000000000000000006451524107121600161570ustar00rootroot00000000000000# Change Log The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release. ## 2.0.0 ### Changed * Require PHP 8.2 or later. * Require `psr/cache` 3. * Add native parameter and return types to the tag interfaces. * Declare taggable item return types on taggable pool reads. ## 1.1.0 * Support PHP 8.1 * Support for psr/cache v2 ## 1.0.1 * Support PHP 8 ## 1.0.0 * First release tag-interop-2.0.0/LICENSE000066400000000000000000000021101524107121600147400ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2015 Aaron Scherer, Tobias Nyholm Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. tag-interop-2.0.0/README.md000066400000000000000000000017301524107121600152210ustar00rootroot00000000000000# Tag interfaces for PSR-6 [![Latest Stable Version](https://poser.pugx.org/cache/tag-interop/v/stable)](https://packagist.org/packages/cache/tag-interop) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) This package defines shared interfaces for tagging PSR-6 cache items and invalidating them by tag. ## Installation ```bash composer require cache/tag-interop:^2.0 ``` ## Usage Tag-aware pools implement `TaggableCacheItemPoolInterface`. Their items implement `TaggableCacheItemInterface`. ```php use Cache\TagInterop\TaggableCacheItemPoolInterface; function invalidateProducts(TaggableCacheItemPoolInterface $pool): bool { return $pool->invalidateTag('products'); } ``` Version 2 extends the interfaces from `psr/cache` 3. ## Contributing Send pull requests to the [main repository](https://github.com/php-cache/cache). Report issues on the [GitHub issue tracker](https://github.com/php-cache/cache/issues). tag-interop-2.0.0/TaggableCacheItemInterface.php000066400000000000000000000020741524107121600215470ustar00rootroot00000000000000, Tobias Nyholm * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace Cache\TagInterop; use Psr\Cache\CacheItemInterface; use Psr\Cache\InvalidArgumentException; /** * An item that supports tags. This interface is a soon-to-be-PSR. * * @author Tobias Nyholm * @author Nicolas Grekas */ interface TaggableCacheItemInterface extends CacheItemInterface { /** * Get all existing tags. These are the tags the item has when the item is * returned from the pool. * * @return array */ public function getPreviousTags(): array; /** * Overwrite all tags with a new set of tags. * * @param array $tags An array of tags * * @throws InvalidArgumentException when a tag is not valid */ public function setTags(array $tags): static; } tag-interop-2.0.0/TaggableCacheItemPoolInterface.php000066400000000000000000000027361524107121600224060ustar00rootroot00000000000000, Tobias Nyholm * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace Cache\TagInterop; use Psr\Cache\CacheItemPoolInterface; use Psr\Cache\InvalidArgumentException; /** * Interface for invalidating cached items using tags. This interface is a soon-to-be-PSR. * * @author Tobias Nyholm * @author Nicolas Grekas */ interface TaggableCacheItemPoolInterface extends CacheItemPoolInterface { /** * Invalidates cached items using a tag. * * @param string $tag The tag to invalidate * * @return bool True on success * * @throws InvalidArgumentException When $tags is not valid */ public function invalidateTag(string $tag): bool; /** * Invalidates cached items using tags. * * @param array $tags An array of tags to invalidate * * @return bool True on success * * @throws InvalidArgumentException When $tags is not valid */ public function invalidateTags(array $tags): bool; public function getItem(string $key): TaggableCacheItemInterface; /** * @param array $keys * * @return iterable */ public function getItems(array $keys = []): iterable; } tag-interop-2.0.0/composer.json000066400000000000000000000015721524107121600164700ustar00rootroot00000000000000{ "name": "cache/tag-interop", "description": "Framework interoperable interfaces for tags", "license": "MIT", "type": "library", "keywords": [ "cache", "psr6", "tag", "psr" ], "authors": [ { "name": "Tobias Nyholm", "email": "tobias.nyholm@gmail.com", "homepage": "https://github.com/nyholm" }, { "name": "Nicolas Grekas ", "email": "p@tchwork.com", "homepage": "https://github.com/nicolas-grekas" } ], "homepage": "https://www.php-cache.com/en/latest/", "require": { "php": "^8.2", "psr/cache": "^3.0" }, "autoload": { "psr-4": { "Cache\\TagInterop\\": "" } }, "extra": { "branch-alias": { "dev-master": "2.0-dev" } } }