You are here

class MockBin in MongoDB 7

Hierarchy

  • class \Drupal\mongodb_cache\Cache implements \Drupal\mongodb_cache\DrupalCacheInterface
    • class \Drupal\mongodb_cache\Tests\MockBin

Expanded class hierarchy of MockBin

File

mongodb_cache/src/Tests/CacheUnitTestCase.php, line 54

Namespace

Drupal\mongodb_cache\Tests
View source
class MockBin extends Cache {

  // @codingStandardsIgnoreEnd

  /**
   * Needs to be repeated although it exists on parent class, to avoid warnings.
   *
   * @var bool
   */
  protected static $isExceptionNotified = FALSE;

  /**
   * MockBin constructor.
   *
   * @param string $bin
   *   The name of the mocked bin.
   */
  public function __construct($bin) {

    // Do not call parent::__construct($bin) to preserve the "mock" aspect.
    $this->collection = new MockCollection($bin);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Cache::$bin protected property The name of the collection holding the cache data.
Cache::$binDataCreator protected property A closure wrapping MongoBinData::__construct() with its default $type.
Cache::$collection protected property The collection holding the cache data.
Cache::$flushVarName protected property The name of the state variable holding the latest bin expire timestamp.
Cache::$stampedeDelay protected property The number of seconds during which a new flush will be ignored.
Cache::$unsafe protected property The default write options for this collection: unsafe mode.
Cache::attemptRemove protected function Attempt removing data from the collection, notifying on exceptions.
Cache::clear public function
Cache::createBinData protected function An alternate \MongoBinData constructor using default $type.
Cache::garbageCollection protected function Garbage collection for get() and getMultiple().
Cache::get public function
Cache::getBinDataCreator protected function Return the proper MongoBinData constructor with its type argument.
Cache::getFlushTimestamp protected function Return the timestamp of the latest flush.
Cache::getMultiple public function
Cache::hasException public static function Has the plugin thrown an exception at any point ?
Cache::isEmpty public function
Cache::notifyException protected static function Display an exception error message only once.
Cache::prepareItem protected function Prepare a cached item.
Cache::set public function
Cache::setFlushTimestamp protected function Record a timestamp as marking the latest flush for the current bin.
MockBin::$isExceptionNotified protected static property Needs to be repeated although it exists on parent class, to avoid warnings. Overrides Cache::$isExceptionNotified
MockBin::__construct public function MockBin constructor. Overrides Cache::__construct