ILIAS  trunk Revision v5.2.0beta1-34132-g2d4d73d4a0
ILIAS\UI\Implementation\Render\LoaderCachingWrapper Class Reference

Caches renderers loaded by another loader. More...

+ Inheritance diagram for ILIAS\UI\Implementation\Render\LoaderCachingWrapper:
+ Collaboration diagram for ILIAS\UI\Implementation\Render\LoaderCachingWrapper:

Public Member Functions

 __construct (Loader $loader)
 
 getRendererFor (Component $component, array $contexts)
 
 getRendererFactoryFor (Component $component)
 

Protected Member Functions

 getCacheKey (Component $component, array $contexts)
 Get a key for the cache. More...
 

Private Attributes

Loader $loader
 
array $cache = array()
 

Detailed Description

Caches renderers loaded by another loader.

Definition at line 28 of file LoaderCachingWrapper.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\UI\Implementation\Render\LoaderCachingWrapper::__construct ( Loader  $loader)

Member Function Documentation

◆ getCacheKey()

ILIAS\UI\Implementation\Render\LoaderCachingWrapper::getCacheKey ( Component  $component,
array  $contexts 
)
protected

Get a key for the cache.

Parameters
Component[]$contexts

Definition at line 63 of file LoaderCachingWrapper.php.

References ILIAS\UI\Component\Component\getCanonicalName().

Referenced by ILIAS\UI\Implementation\Render\LoaderCachingWrapper\getRendererFor().

63  : string
64  {
65  return $component->getCanonicalName() . " " . implode("_", $this->getContextNames($contexts));
66  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRendererFactoryFor()

ILIAS\UI\Implementation\Render\LoaderCachingWrapper::getRendererFactoryFor ( Component  $component)

Implements ILIAS\UI\Implementation\Render\Loader.

Definition at line 71 of file LoaderCachingWrapper.php.

71  : RendererFactory
72  {
73  return $this->loader->getRendererFactoryFor($component);
74  }

◆ getRendererFor()

ILIAS\UI\Implementation\Render\LoaderCachingWrapper::getRendererFor ( Component  $component,
array  $contexts 
)

Implements ILIAS\UI\Implementation\Render\Loader.

Definition at line 47 of file LoaderCachingWrapper.php.

References ILIAS\LTI\ToolProvider\$key, and ILIAS\UI\Implementation\Render\LoaderCachingWrapper\getCacheKey().

47  : ComponentRenderer
48  {
49  $key = $this->getCacheKey($component, $contexts);
50  if (isset($this->cache[$key])) {
51  return $this->cache[$key];
52  }
53  $renderer = $this->loader->getRendererFor($component, $contexts);
54  $this->cache[$key] = $renderer;
55  return $renderer;
56  }
string $key
Consumer key/client ID value.
Definition: System.php:193
getCacheKey(Component $component, array $contexts)
Get a key for the cache.
+ Here is the call graph for this function:

Field Documentation

◆ $cache

array ILIAS\UI\Implementation\Render\LoaderCachingWrapper::$cache = array()
private

Definition at line 37 of file LoaderCachingWrapper.php.

◆ $loader

Loader ILIAS\UI\Implementation\Render\LoaderCachingWrapper::$loader
private

The documentation for this class was generated from the following file: