PHP code example of juliangut / cacheware

1. Go to this page and download the library: Download juliangut/cacheware 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/ */

    

juliangut / cacheware example snippets




use \Jgut\Middleware\CacheWare

$configuration = [
  'limiter' => 'private',
  'expire' => 1800, // 30 minutes
];

$cacheMiddleware = new CacheWare($configuration);

// Get $request and $response from PSR7 implementation
$request = new Request();
$response = new Response();

$response = $cacheMiddleware($request, $response, function() { });

// Response has corresponding cache headers for private cache



use \Jgut\Middleware\CacheWare

$app = new \YourMiddlewareAwareApplication();
$app->addMiddleware(new CacheWare(['limiter' => 'nocache']));
$app->run();

$cacheMiddleware = new CacheWare([
  'limiter' => null
  'expire' => 180,
]);