xima/t3api-cache
最新稳定版本:0.1.0
Composer 安装命令:
composer require xima/t3api-cache
包简介
Adds caching to the t3api extension.
README 文档
README
This extension provides a simple cache for the API response of the TYPO3 extension t3api.
Installation
Install the extension via composer:
composer require xima/t3api-cache
Usage
The extension provides a new Annotation @ApiCache which can be used in your ApiResource class to active caching for the specific resource:
<?php use Xima\T3ApiCache\Annotation\ApiCache; /** * @ApiResource( * collectionOperations={ * "get": { * "path": "/news" * } * } * ) * @ApiCache */ class News extends AbstractEntity { }
Configuration
There a two configuration options available:
parametersToIgnore
This option allows you to prevent caching of the response for specific query parameters. This can be useful if you have e.g. a search parameter which should not be cached, since it is too individual.
<?php use SourceBroker\T3api\Annotation\ApiFilter; use SourceBroker\T3api\Filter\SearchFilter; use Xima\T3ApiCache\Annotation\ApiCache; /** * ... * @ApiFilter(SearchFilter::class, properties={"title": "partial", "teaser": "partial"}, arguments={"parameterName": "search"}) * @ApiCache(parametersToIgnore={"search"}) */ class ExampleResource extends AbstractEntity { }
lifetime
The lifetime of the cache entry in seconds. Default is 86400 (1 day).
<?php use Xima\T3ApiCache\Annotation\ApiCache; /** * ... * @ApiCache(lifetime=3600) // Cache lifetime set to 1 hour */ class ExampleResource extends AbstractEntity { }
统计信息
- 总下载量: 2.59k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2024-12-25