Skip to content

Instantly share code, notes, and snippets.

@nyeholt
Created January 4, 2016 06:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nyeholt/adb0e4ec0c81e939a201 to your computer and use it in GitHub Desktop.
Save nyeholt/adb0e4ec0c81e939a201 to your computer and use it in GitHub Desktop.
<?php
if (defined('YML_PROXY_CONFIG_FILE')) {
$ymlFile = YML_PROXY_CONFIG_FILE;
if ($ymlFile{0} != '/') {
$ymlFile = BASE_PATH . '/' . $ymlFile;
}
$publisherName = defined('PROXY_PUBLISHER') ? PROXY_PUBLISHER : null;
$dynamicName = defined('PROXY_DYNAMIC_PUBLISHER') ? PROXY_DYNAMIC_PUBLISHER : null;
$array = Yaml::parse(file_get_contents($ymlFile));
if ($publisherName && isset($array['Injector']['PublisherCache'])) {
SimpleCache::$cache_configs[$publisherName] = array(
'store_type' => $array['Injector']['PublisherCacheStore']['class'],
'store_options' => array($array['Injector']['PublisherCacheStore']['constructor'][0]),
'cache_options' => array(
'expiry' => $array['Injector']['PublisherCache']['properties']['expiry']
)
);
}
if ($dynamicName && isset($array['Injector']['DynamicPublisherCache'])) {
SimpleCache::$cache_configs[$dynamicName] = array(
'store_type' => $array['Injector']['DynamicPublisherCacheStore']['class'],
'store_options' => array($array['Injector']['DynamicPublisherCacheStore']['constructor'][0]),
'cache_options' => array(
'expiry' => $array['Injector']['DynamicPublisherCache']['properties']['expiry']
)
);
}
if (isset($array['Injector']['FragmentCache'])) {
SimpleCache::$cache_configs['FragmentCache'] = array(
'store_type' => $array['Injector']['FragmentCacheStore']['class'],
'store_options' => array($array['Injector']['FragmentCacheStore']['constructor'][0]),
'cache_options' => array(
'expiry' => $array['Injector']['FragmentCache']['properties']['expiry']
)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment