Set disable-segmentation for SSViewer cache

Cleanup
This commit is contained in:
Damian Mooyman 2018-06-01 15:49:16 +12:00
parent 05a519ecc5
commit 779a4e2443
4 changed files with 19 additions and 7 deletions

View File

@ -110,7 +110,7 @@ class SS_ConfigManifest {
/** /**
* Provides a hook for mock unit tests despite no DI * Provides a hook for mock unit tests despite no DI
* @return Zend_Cache_Frontend * @return Zend_Cache_Core
*/ */
protected function getCache() protected function getCache()
{ {

View File

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

View File

@ -118,7 +118,7 @@ class i18n extends SS_Object implements TemplateGlobalProvider, Flushable {
/** /**
* Return an instance of the cache used for i18n data. * Return an instance of the cache used for i18n data.
* @return Zend_Cache * @return Zend_Cache_Core
*/ */
public static function get_cache() { public static function get_cache() {
return SS_Cache::factory( return SS_Cache::factory(

View File

@ -31,10 +31,10 @@ class SSViewer_Scope {
const UP_INDEX = 4; const UP_INDEX = 4;
const CURRENT_INDEX = 5; const CURRENT_INDEX = 5;
const ITEM_OVERLAY = 6; const ITEM_OVERLAY = 6;
// The stack of previous "global" items // The stack of previous "global" items
// An indexed array of item, item iterator, item iterator total, pop index, up index, current index & parent overlay // An indexed array of item, item iterator, item iterator total, pop index, up index, current index & parent overlay
private $itemStack = array(); private $itemStack = array();
// The current "global" item (the one any lookup starts from) // The current "global" item (the one any lookup starts from)
protected $item; protected $item;
@ -1016,6 +1016,14 @@ class SSViewer implements Flushable {
} }
} }
/**
* @return Zend_Cache_Core
*/
protected static function defaultPartialCacheStore()
{
return SS_Cache::factory('cacheblock', 'Output', array('disable-segmentation' => true));
}
/** /**
* Call this to disable rewriting of <a href="#xxx"> links. This is useful in Ajax applications. * Call this to disable rewriting of <a href="#xxx"> links. This is useful in Ajax applications.
* It returns the SSViewer objects, so that you can call new SSViewer("X")->dontRewriteHashlinks()->process(); * It returns the SSViewer objects, so that you can call new SSViewer("X")->dontRewriteHashlinks()->process();
@ -1082,7 +1090,7 @@ class SSViewer implements Flushable {
*/ */
public static function flush_cacheblock_cache($force = false) { public static function flush_cacheblock_cache($force = false) {
if (!self::$cacheblock_cache_flushed || $force) { if (!self::$cacheblock_cache_flushed || $force) {
$cache = SS_Cache::factory('cacheblock'); $cache = self::defaultPartialCacheStore();
$backend = $cache->getBackend(); $backend = $cache->getBackend();
if( if(
@ -1120,7 +1128,7 @@ class SSViewer implements Flushable {
* @return Zend_Cache_Core * @return Zend_Cache_Core
*/ */
public function getPartialCacheStore() { public function getPartialCacheStore() {
return $this->partialCacheStore ? $this->partialCacheStore : SS_Cache::factory('cacheblock'); return $this->partialCacheStore ? $this->partialCacheStore : self::defaultPartialCacheStore();
} }
/** /**