Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]

   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * The library file for the file cache store.
  19   *
  20   * This file is part of the file cache store, it contains the API for interacting with an instance of the store.
  21   * This is used as a default cache store within the Cache API. It should never be deleted.
  22   *
  23   * @package    cachestore_file
  24   * @category   cache
  25   * @copyright  2012 Sam Hemelryk
  26   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  27   */
  28  
  29  defined('MOODLE_INTERNAL') || die();
  30  
  31  $string['asyncpurge'] = 'Asynchronously purge directory';
  32  $string['asyncpurge_help'] = 'If enabled, the new directory is created with cache revision and the old directory will be deleted asynchronously via a scheduled task.';
  33  $string['autocreate'] = 'Auto create directory';
  34  $string['autocreate_help'] = 'If enabled the directory specified in path will be automatically created if it does not already exist.';
  35  $string['lockwait'] = 'Maximum lock wait time';
  36  $string['lockwait_help'] = 'The maximum amount of time in seconds to wait for an exclusive lock before reading or writing a cache key. This is only used for cache definitions that have read or write locking required.';
  37  $string['path'] = 'Cache path';
  38  $string['path_help'] = 'The directory that should be used to store files for this cache store. If left blank (default) a directory will be automatically created in the moodledata directory. This can be used to point a file store towards a directory on a better performing drive (such as one in memory).';
  39  $string['pluginname'] = 'File cache';
  40  $string['privacy:metadata'] = 'The File cache cachestore plugin stores data briefly as part of its caching functionality but this data is regularly cleared.';
  41  $string['prescan'] = 'Prescan directory';
  42  $string['prescan_help'] = 'If enabled the directory is scanned when the cache is first used and requests for files are first checked against the scan data. This can help if you have a slow file system and are finding that file operations are causing you a bottle neck.';
  43  $string['singledirectory'] = 'Single directory store';
  44  $string['singledirectory_help'] = 'If enabled files (cached items) will be stored in a single directory rather than being broken up into multiple directories.
  45  
  46  Enabling this will speed up file interactions but comes at the cost of increased risk of hitting file system limitations.
  47  
  48  It is advisable to only turn this on if the following is true:
  49  
  50  * If you know the number of items in the cache is going to be small enough that it won\'t cause issues on the file system you are running with.
  51  * The data being cached is not expensive to generate. If it is then sticking with the default may still be the better option as it reduces the chance of issues.';
  52  $string['task_asyncpurge'] = 'Asynchronously purge file store old cache revision directories';
  53  
  54  /**
  55   * This is is like the file store, but designed for siutations where:
  56   *   - many more things are likely to be stored in the cache, so CRC hashing is
  57   *     too likely to give collisions, and storing everything in a completely flat
  58   *     directory structure is inadvisable.
  59   *   - the things we are caching are more expensive to calculate, so the extra
  60   *     time to computer a better hash is a worthwhile trade-off.
  61   */