switon/http-cache

HTTP response caching filter for Switon Framework

Maintainers

Package info

github.com/switon-php/http-cache

Documentation

pkg:composer/switon/http-cache

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-05-10 03:47 UTC

This package is auto-updated.

Last update: 2026-05-10 03:49:43 UTC


README

HTTP response caching filter for Switon Framework.

Installation

composer require switon/http-cache

Requirements: PHP 8.3+

Quick Start

use Switon\Http\RequestInterface;
use Switon\HttpCache\Attribute\PageCache;
use Switon\Routing\Attribute\GetMapping;

class ProductController
{
    #[GetMapping('/products')]
    #[PageCache(ttl: 600, key: ['category', 'page'])]
    public function listAction(RequestInterface $request): array
    {
        $category = $request->get('category', 'all');
        $page = (int)$request->get('page', 1);

        return [
            'category' => $category,
            'page' => $page,
            'items' => $this->loadProducts($category, $page),
        ];
    }
}

Docs: https://docs.switon.dev/latest/http-cache

License

MIT.