Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Pour ceux qui se demandent comment on fait pour cacher rapidement à l'arrache les 5 pages les plus demandées ;)
- // Et soutenez La Quadrature du Net \o/ https://soutien.laquadrature.net/
- // CACHE STATIQUE BS "poor's-man-cache"
- // INTRO
- $uris=array("/","/why","/faq","/what","/how","/material");
- $duration=300;
- if (in_array($_SERVER["REQUEST_URI"],$uris)) {
- $cache="CACHE/root.".$_SERVER["HTTP_HOST"].".".str_replace("/","",$_SERVER["REQUEST_URI"]);
- if (file_exists($cache) && @filemtime($cache)> (time()-$duration) ) {
- readfile($cache);
- exit();
- } else {
- ob_start();
- }
- }
- // Retrieve instance of the framework
- $f3=require('lib/base.php');
- // Initialize CMS
- $f3->config('app/config.ini');
- // Define routes
- $f3->config('app/routes.ini');
- // Execute application
- $f3->run();
- // CACHE STATIQUE OUTRO
- if (in_array($_SERVER["REQUEST_URI"],$uris)) {
- file_put_contents($cache,ob_get_flush());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement