Remove segmentation from core caches

This commit is contained in:
Aaron Carlino 2018-06-01 11:05:03 +12:00 committed by Damian Mooyman
parent 0b18090003
commit dac3c5ee16
7 changed files with 15 additions and 6 deletions

2
cache/Cache.php vendored
View File

@ -192,7 +192,7 @@ class SS_Cache {
$frontend, $backend[0], $frontendOptions, $backend[1]
);
if (isset($frontendOptions['disable-container']) && $frontendOptions['disable-container']) {
if (isset($frontendOptions['disable-segmentation']) && $frontendOptions['disable-segmentation']) {
return $cache;
}

View File

@ -118,6 +118,7 @@ class SS_ConfigManifest {
'automatic_serialization' => true,
'lifetime' => null,
'cache_id_prefix' => 'SS_Configuration_',
'disable-segmentation' => true,
));
}

View File

@ -83,7 +83,7 @@ class SilverStripeVersionProvider
$lockData = array();
if ($cache) {
$cache = SS_Cache::factory('SilverStripeVersionProvider_composerlock');
$cache = SS_Cache::factory('SilverStripeVersionProvider_composerlock', 'Output', array('disable-segmentation' => true));
$cacheKey = filemtime($composerLockPath);
if ($versions = $cache->load($cacheKey)) {
$lockData = json_decode($versions, true);

View File

@ -39,7 +39,7 @@ class GDBackend extends SS_Object implements Image_Backend {
// If we're working with image resampling, things could take a while. Bump up the time-limit
increase_time_limit_to(300);
$this->cache = SS_Cache::factory('GDBackend_Manipulations');
$this->cache = SS_Cache::factory('GDBackend_Manipulations', 'Output', array('disable-segmentation' => true));
if($filename && is_readable($filename)) {
$this->cacheKey = md5(implode('_', array($filename, filemtime($filename))));

View File

@ -121,7 +121,15 @@ class i18n extends SS_Object implements TemplateGlobalProvider, Flushable {
* @return Zend_Cache
*/
public static function get_cache() {
return SS_Cache::factory('i18n', 'Output', array('lifetime' => null, 'automatic_serialization' => true));
return SS_Cache::factory(
'i18n',
'Output',
array(
'lifetime' => null,
'automatic_serialization' => true,
'disable-segmentation' => true,
)
);
}
/**

View File

@ -35,7 +35,7 @@ class CleanImageManipulationCache extends BuildTask {
$images = DataObject::get('Image');
if($images && Image::get_backend() == "GDBackend") {
$cache = SS_Cache::factory('GDBackend_Manipulations');
$cache = SS_Cache::factory('GDBackend_Manipulations', 'Output', array('disable-segmentation' => true));
foreach($images as $image) {
$path = $image->getFullPath();

View File

@ -105,7 +105,7 @@ class CacheTest extends SapphireTest {
}
public function testDisableVersionedCacheSegmentation() {
$cacheInstance = SS_Cache::factory('versioned_disabled', 'Output', ['disable-container' => true]);
$cacheInstance = SS_Cache::factory('versioned_disabled', 'Output', array('disable-segmentation' => true));
$cacheInstance->clean();
Versioned::set_reading_mode('Stage.Live');