Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getConfigCacheFactory example
$this
->matcher =
new
$this
->options
[
'matcher_class'
]
(
$routes
,
$this
->context
)
;
if
(
method_exists
(
$this
->matcher, 'addExpressionLanguageProvider'
)
)
{
foreach
(
$this
->expressionLanguageProviders
as
$provider
)
{
$this
->matcher->
addExpressionLanguageProvider
(
$provider
)
;
}
}
return
$this
->matcher;
}
$cache
=
$this
->
getConfigCacheFactory
(
)
->
cache
(
$this
->options
[
'cache_dir'
]
.'/url_matching_routes.php',
function
DConfigCacheInterface
$cache
)
{
$dumper
=
$this
->
getMatcherDumperInstance
(
)
;
if
(
method_exists
(
$dumper
, 'addExpressionLanguageProvider'
)
)
{
foreach
(
$this
->expressionLanguageProviders
as
$provider
)
{
$dumper
->
addExpressionLanguageProvider
(
$provider
)
;
}
}
$cache
->
write
(
$dumper
->
dump
(
)
,
$this
->
getRouteCollection
(
)
->
getResources
(
)
)
;
}
)
;
$this
->
loadFallbackCatalogues
(
$locale
)
;
}
private
function
initializeCacheCatalogue
(
string
$locale
)
: void
{
if
(
isset
(
$this
->catalogues
[
$locale
]
)
)
{
/* Catalogue already initialized. */
return
;
}
$this
->
assertValidLocale
(
$locale
)
;
$cache
=
$this
->
getConfigCacheFactory
(
)
->
cache
(
$this
->
getCatalogueCachePath
(
$locale
)
,
function
DConfigCacheInterface
$cache
)
use
(
$locale
)
{
$this
->
dumpCatalogue
(
$locale
,
$cache
)
;
}
)
;
if
(
isset
(
$this
->catalogues
[
$locale
]
)
)
{
/* Catalogue has been initialized as it was written out to cache. */
return
;
}
/* Read catalogue from cache. */
$this
->matcher =
new
$this
->options
[
'matcher_class'
]
(
$routes
,
$this
->context
)
;
if
(
method_exists
(
$this
->matcher, 'addExpressionLanguageProvider'
)
)
{
foreach
(
$this
->expressionLanguageProviders
as
$provider
)
{
$this
->matcher->
addExpressionLanguageProvider
(
$provider
)
;
}
}
return
$this
->matcher;
}
$cache
=
$this
->
getConfigCacheFactory
(
)
->
cache
(
$this
->options
[
'cache_dir'
]
.'/url_matching_routes.php',
function
DConfigCacheInterface
$cache
)
{
$dumper
=
$this
->
getMatcherDumperInstance
(
)
;
if
(
method_exists
(
$dumper
, 'addExpressionLanguageProvider'
)
)
{
foreach
(
$this
->expressionLanguageProviders
as
$provider
)
{
$dumper
->
addExpressionLanguageProvider
(
$provider
)
;
}
}
$cache
->
write
(
$dumper
->
dump
(
)
,
$this
->
getRouteCollection
(
)
->
getResources
(
)
)
;
}
)
;