cache() публичный статический Метод

Returns or sets the page cache used for mapping message ids to translations.
public static cache ( array $cache = null ) : array
$cache array A multidimensional array to use when pre-populating the cache. The structure of the array is `scope/locale/id`. If `false`, the cache is cleared.
Результат array Returns an array of cached pages, formatted per the description for `$cache`.
Пример #1
0
 public function testCaching()
 {
     $data = array('catalog' => 'Katalog');
     Catalog::write('runtime', 'message', 'de', $data, array('scope' => 'foo'));
     $this->assertFalse(Message::cache());
     $result = Message::translate('catalog', array('locale' => 'de', 'scope' => 'foo'));
     $this->assertEqual('Katalog', $result);
     $cache = Message::cache();
     $this->assertEqual('Katalog', $cache['foo']['de']['catalog']);
     Message::cache(false);
     $this->assertFalse(Message::cache());
     Message::cache(array('foo' => array('de' => array('catalog' => '<Katalog>'))));
     $result = Message::translate('catalog', array('locale' => 'de', 'scope' => 'foo'));
     $this->assertEqual('<Katalog>', $result);
     $options = array('locale' => 'de', 'scope' => 'foo', 'count' => 2);
     $this->assertEqual('<Katalog>', Message::translate('catalog', $options));
     Message::cache(false);
     Message::cache(array('foo' => array('de' => array('catalog' => array('<Katalog>')))));
     $this->assertNull(Message::translate('catalog', $options));
 }