コード例 #1
0
ファイル: CacheMapper.php プロジェクト: sitesupra/sitesupra
 protected function getContextKey(ResponseContext $context = null)
 {
     if (!$context) {
         return 'no_context';
     }
     $cacheParts = array();
     $values = $context->getAllValues();
     ksort($values);
     foreach ($values as $value) {
         $cacheParts[] = $value;
     }
     return implode('_', $cacheParts);
 }
コード例 #2
0
 /**
  * Flushes all data to another response context
  * @param ResponseContext $mainContext
  */
 public function flushToContext(ResponseContext $mainContext)
 {
     foreach ($this->getAllValues() as $key => $value) {
         $mainContext->setValue($key, $value);
     }
     foreach ($this->layoutSnippetResponses as $key => $responses) {
         foreach ($responses as $snippet) {
             $mainContext->addToLayoutSnippet($key, $snippet);
         }
     }
 }