PHP code example of cleardevice / slim-middleware-apc-cache
1. Go to this page and download the library: Download cleardevice/slim-middleware-apc-cache 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/ */
cleardevice / slim-middleware-apc-cache example snippets
= new \Slim\Slim();
use cleardevice\SlimMiddlewareAPCCache\SlimMiddlewareAPCCache;
$app->add(new SlimMiddlewareAPCCache(60, 'myapp_prefix_');
$app->get('/foo_1', function () use ($app) {
echo "Hello Bar, default ttl";
});
$app->get('/foo_2', function () use ($app) {
echo "Hello Bar, custom cache ttl";
$this->app->container->set(SlimMiddlewareAPCCache::TTL_KEY, 3600);
});
$app->get('/foo_3', function () use ($app) {
echo "Hello Bar, no cache";
$this->app->container->set(SlimMiddlewareAPCCache::TTL_KEY, SlimMiddlewareAPCCache::TTL_NO_CACHE);
});
$app->get('/foo_4', function () use ($app) {
echo "Hello Bar, permanent cache";
$this->app->container->set(SlimMiddlewareAPCCache::TTL_KEY, SlimMiddlewareAPCCache::TTL_PERMANENT_CACHE);
});
$app->run();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.