PHP code example of marko / page-cache-file
1. Go to this page and download the library: Download marko/page-cache-file library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
marko / page-cache-file example snippets
use Marko\PageCache\Attributes\Cacheable;
use Marko\Routing\Attributes\Get;
use Marko\Routing\Http\Response;
class ProductController
{
#[Get('/products/{id}')]
#[Cacheable(ttl: 3600, tags: ['products', 'product-{id}'])]
public function show(int $id): Response
{
return Response::ok($this->productRepository->find($id));
}
}