/**
  *
  */
 public function testSettings()
 {
     SquirrelCache::setCacheActive(false);
     $this->assertFalse(SquirrelCache::isCacheActive(), "Set Cache to inactive, but did not come back false.");
     SquirrelCache::setCacheActive(true);
     $this->assertTrue(SquirrelCache::isCacheActive(), "Set Cache to active, but did not come back true.");
     $prefix = self::CACHE_PREFIX;
     $class = "App\\User";
     SquirrelCache::setCacheKeyPrefix($prefix);
     $plainPrefix = SquirrelCache::getCacheKeyPrefix();
     $expectedPrefix = $prefix . "::";
     $this->assertEquals($plainPrefix, $expectedPrefix, "Set prefix to `{$plainPrefix}`, but didn't get expected result `{$expectedPrefix}`");
     $classPrefix = SquirrelCache::getCacheKeyPrefix($class);
     $expectedPrefix = $prefix . "::" . $class . "::";
     $this->assertEquals($classPrefix, $expectedPrefix, "Set prefix to `{$plainPrefix}` with Class `{$class}`, but didn't get expected result `{$expectedPrefix}`");
 }
示例#2
0
 /**
  * Helper method to quickly determine if cacheing should be used for this class.  It will verify the model
  * cache is active, and the global cache option is active.
  *
  * @access public
  * @final
  * @static
  * @return boolean
  */
 public final function isCacheing()
 {
     return $this->isCacheActive() && SquirrelCache::isCacheActive();
 }