/**
  * Return the cache key name for the current table, language and domain.
  *
  * @return string
  */
 protected function cacheKey()
 {
     if ($this->cacheKey === null) {
         $this->cacheKey = CacheKey::behavior($this) . '_' . CacheKey::table($this->_table);
     }
     return $this->cacheKey;
 }
Exemplo n.º 2
0
 /**
  * Tests for the CacheKey::behavior method.
  *
  * @return void
  * @covers Database\Utility\CodeLogic\CacheKey::behavior
  */
 public function testBehavior()
 {
     $items = TableRegistry::get('Items');
     $items->addBehavior('DatabaseAutovalidate', ['className' => 'Database.Autovalidate']);
     $items->addBehavior('DatabaseFormattable', ['className' => 'Database.Formattable']);
     $items->addBehavior('Timestamp', ['className' => 'Timestamp']);
     $result = CacheKey::behavior($items->behaviors()->get('DatabaseAutovalidate'));
     $this->assertEquals('plugin_database_autovalidate_behavior', $result);
     $result = CacheKey::behavior($items->behaviors()->get('DatabaseFormattable'));
     $this->assertEquals('plugin_database_formattable_behavior', $result);
     $result = CacheKey::behavior($items->behaviors()->get('Timestamp'));
     $this->assertEquals('cake_timestamp_behavior', $result);
 }
 /**
  * Return the cache key name for the current table, language and domain.
  *
  * @return string
  */
 public function cacheKey()
 {
     if ($this->cacheKey === null) {
         $this->cacheKey = implode('_', [CacheKey::behavior($this), CacheKey::table($this->_table), strtolower(ini_get('intl.default_locale')), $this->config('domain')]);
     }
     return $this->cacheKey;
 }