ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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)
 @inheritdocs More...
 
 getRendererFactoryFor (Component $component)
 @inheritdocs More...
 
 getRendererFor (Component $component, array $contexts)
 Get a renderer for a certain Component class. More...
 
 getRendererFactoryFor (Component $component)
 Get a factory for a renderer for a certain component class. More...
 

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.

63 : string
64 {
65 return $component->getCanonicalName() . " " . implode("_", $this->getContextNames($contexts));
66 }
getCanonicalName()
Get the canonical name of the component.

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

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

+ 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)

@inheritdocs

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 
)

@inheritdocs

Implements ILIAS\UI\Implementation\Render\Loader.

Definition at line 47 of file LoaderCachingWrapper.php.

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 }
$renderer
getCacheKey(Component $component, array $contexts)
Get a key for the cache.

References $renderer, and ILIAS\UI\Implementation\Render\LoaderCachingWrapper\getCacheKey().

+ 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: