NullBackend.php 2.07 KB
Newer Older
1 2 3 4
<?php

/**
 * @file
5
 * Definition of Drupal\Core\Cache\NullBackend.
6 7
 */

8
namespace Drupal\Core\Cache;
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

/**
 * Defines a stub cache implementation.
 *
 * The stub implementation is needed when database access is not yet available.
 * Because Drupal's caching system never requires that cached data be present,
 * these stub functions can short-circuit the process and sidestep the need for
 * any persistent storage. Using this cache implementation during normal
 * operations would have a negative impact on performance.
 *
 * This also can be used for testing purposes.
 */
class NullBackend implements CacheBackendInterface {

  /**
24
   * Implements Drupal\Core\Cache\CacheBackendInterface::__construct().
25 26 27 28
   */
  function __construct($bin) {}

  /**
29
   * Implements Drupal\Core\Cache\CacheBackendInterface::get().
30 31 32 33 34 35
   */
  function get($cid) {
    return FALSE;
  }

  /**
36
   * Implements Drupal\Core\Cache\CacheBackendInterface::getMultiple().
37 38 39 40 41 42
   */
  function getMultiple(&$cids) {
    return array();
  }

  /**
43
   * Implements Drupal\Core\Cache\CacheBackendInterface::set().
44
   */
45
  function set($cid, $data, $expire = CACHE_PERMANENT, array $tags = array()) {}
46 47

  /**
48
   * Implements Drupal\Core\Cache\CacheBackendInterface::delete().
49 50 51 52
   */
  function delete($cid) {}

  /**
53
   * Implements Drupal\Core\Cache\CacheBackendInterface::deleteMultiple().
54 55 56 57
   */
  function deleteMultiple(array $cids) {}

  /**
58
   * Implements Drupal\Core\Cache\CacheBackendInterface::deletePrefix().
59 60 61 62
   */
  function deletePrefix($prefix) {}

  /**
63
   * Implements Drupal\Core\Cache\CacheBackendInterface::flush().
64 65 66 67
   */
  function flush() {}

  /**
68
   * Implements Drupal\Core\Cache\CacheBackendInterface::expire().
69 70 71 72
   */
  function expire() {}

  /**
73
   * Implements Drupal\Core\Cache\CacheBackendInterface::garbageCollection().
74 75 76
   */
  function garbageCollection() {}

77 78 79 80 81
  /**
   * Implements Drupal\Core\Cache\CacheBackendInterface::invalidateTags().
   */
  public function invalidateTags(array $tags) {}

82
  /**
83
   * Implements Drupal\Core\Cache\CacheBackendInterface::isEmpty().
84 85 86 87 88
   */
  function isEmpty() {
    return TRUE;
  }
}