ssch / typo3-psr-cache-adapter
为TYPO3提供适配器,使其与PSR-6兼容
v1.2.2
2023-12-08 11:29 UTC
Requires
- php: ^7.4 || ^8.0
- psr/cache: ^1.0 || ^2.0
- psr/simple-cache: ^1.0
- typo3/cms-core: ^10.4 || ^11.4 || ^12.4
Requires (Dev)
- php-parallel-lint/php-parallel-lint: ^1.3
- phpstan/extension-installer: ^1.2
- phpstan/phpstan: ^1.8
- phpstan/phpstan-phpunit: ^1.2
- phpstan/phpstan-strict-rules: ^1.4
- saschaegerer/phpstan-typo3: ^1.8
- symplify/easy-coding-standard: ^12.0
- typo3/testing-framework: ^6.16 || ^7.0
Provides
- psr/cache-implementation: 2.0 || 3.0
- psr/simple-cache-implementation: 1.0
This package is auto-updated.
Last update: 2024-09-08 12:58:13 UTC
README
为TYPO3缓存框架提供PSR-6和PSR-16兼容的缓存适配器。
使用方法
为了简化创建PSR-6或PSR-16兼容的缓存对象,扩展提供了两个工厂:一个用于PSR-6,一个用于PSR-16。
通过利用Symfony DI配置创建PSR-6或PSR-16兼容的缓存对象
use Psr\Cache\CacheItemPoolInterface; use Ssch\Cache\Factory\Psr6Factory; use MyNamespace\MyExtensionKey\Service\MyService; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use function Symfony\Component\DependencyInjection\Loader\Configurator\service; return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->defaults() ->autowire() ->private() ->autoconfigure(); $services->set('cache.psr6.typo3_psr_cache_adapter_test', CacheItemPoolInterface::class) ->factory([service(Psr6Factory::class), 'create']) ->args(['typo3_psr_cache_adapter_test']); $services->set(MyService::class) ->args([service('cache.psr6.typo3_psr_cache_adapter_test')]); };
注意typo3_psr_cache_adapter_test。这是您在配置TYPO3缓存以用于TYPO3缓存框架时使用的缓存标识符。