PHP Classes

File: examples/config.php

Recommend this page to a friend!
  Classes of Muhammed M   PHP Page Cache Output   examples/config.php   Download  
File: examples/config.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: PHP Page Cache Output
Store full page output in cache files
Author: By
Last change: Dry Run Mode introduced
Date: 6 years ago
Size: 4,100 bytes
 

Contents

Class file image Download
<?php
/**
 * This file is part of the PageCache package.
 *
 * @author Muhammed Mamedov <mm@turkmenweb.net>
 * @copyright 2016
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 *
 * Example configuration file
 *
 * Sample config array with all possible values.
 * Copy this configuration file to your local location and edit values that you need.
 *
 * You do not need to copy this config file and use it, you could set up all parameters directly inside code.
 * If you have caching enabled on several pages, and do not want to repeat cache settings, then config file is for you.
 *
 * Options `file_lock`, `cache_path` and `min_cache_file_size` are ignored if custom PSR-16 SimpleCache adapter is used.
 *
 * NOTE: Parameters defined here in $config array are used by all pages using PageCache within you application.
 * You can override any of these settings in your code.
 *
 * Feel free to comment out any settings you don't need.
 *
 */
return [

   
/**
     * Minimum cache file size.
     * Generated cache files less than this many bytes, are considered invalid and are regenerated
     * Default 10
     */
   
'min_cache_file_size' => 10,

   
/**
     * Set true to enable logging, not recommended for production use, only for debugging
     * Default: false
     *
     * Effects both internal logger, and any external PSR-3 logger (if any) activated via setLogger() method
     */
   
'enable_log' => false,

   
/**
     * Internal log file location, enable_log must be true for logging to work
     * When external logger is provided via setLogger(), internal logging is disabled.
     */
   
'log_file_path' => __DIR__ . '/log/cache.log',

   
/**
     * Current page's cache expiration in seconds.
     * Default: 20 minutes, 1200 seconds.
     */
   
'cache_expiration_in_seconds' => 1200,

   
/**
     * Cache directory location (mind the trailing slash "/").
     * Cache files are saved here.
     */
   
'cache_path' => __DIR__ . '/cache/',

   
/**
     * Use session support, if you have a login area or similar.
     * When page content changes according to some Session value, although URL remains the same.
     * Disabled by default.
     */
   
'use_session' => false,

   
/**
     * Exclude $_SESSION key(s) from caching strategies. Pass session name as keys to the array.
     *
     * When to use: Your application changes $_SESSION['count'] variable, but that doesn't reflect on the page
     * content. Exclude this variable, otherwise PageCache will generate seperate cache files for each
     * value of $_SESSION['count] session variable.
     * Example: 'session_exclude_keys'=>array('count')
     */
   
'session_exclude_keys' => [],

   
/**
     *
     * Locking mechanism to use when writing cache files. Default is LOCK_EX | LOCK_NB, which locks for
     * exclusive write while being non-blocking. Set whatever you want.
     * Read for details (http://php.net/manual/en/function.flock.php)
     *
     * Set file_lock = false to disable file locking.
     */
   
'file_lock' => LOCK_EX | LOCK_NB,

   
/**
     * Send appropriate HTTP cache related headers in response or not.
     * When true headers are sent, when false not being sent.
     *
     * When set to true:
     * First call to your URL results in HTTP Response code 200.
     * Consequent calls, until page expiration, will result in 304 Not Modified.
     * When 304 is being returned, no content is retrieved from the server.
     * This makes your application load super fast - cached content comes from web browser.
     */
   
'send_headers' => false,

   
/**
     * Use Last-Modified and ETag values generated by application or not.
     * Values will be fetched from the current response.
     */
   
'forward_headers' => false,

   
/**
     * Dry Run Mode.
     * When enabled no cache headers will be sent, no cache output will be sent.
     * Cache items will be saved.
     * Use this to test system.
     */
   
'dry_run_mode' =>false
];