Allows disabling page-caching by setting the cache flag on a controller

<customer_account>
<turpentine_cache_flag value="0" />
</customer_account>

Events: controller_action_layout_generate_blocks_after

@param  Varien_Object $eventObject
@return null
965056
public function checkCacheFlag($eventObject) {
        if (Mage::helper('turpentine/varnish')->shouldResponseUseVarnish()) {
            $layoutXml = $eventObject->getLayout()->getUpdate()->asSimplexml();
            foreach ($layoutXml->xpath('//turpentine_cache_flag') as $node) {
                foreach ($node->attributes() as $attr => $value) {
                    if ($attr == 'value') {
                        if ( ! (string) $value) {
                            Mage::register('turpentine_nocache_flag', true, true);
                            return; //only need to set the flag once
                        }
                    }
                }
            }
        }
    }
492836
public function resolveContentForArticlePageOnPostSerialize(ObjectEvent $event)
    {
        $article = $event->getObject();
        $visitor = $event->getVisitor();
        $context = $event->getContext();

        if (!$article instanceof ArticlePageDocument || !$context->attributes->containsKey('website')) {
            return;
        }

        $content = $this->resolve($article);
        foreach ($content as $name => $value) {
            $visitor->addData($name, $value);
        }
    }
916672
public function setHeaders(EventInterface $event) {
        $method = $event->getRequest()->getMethod();

        // Obviously we shouldn't bother doing any HTTP caching logic for non-GET/HEAD requests
        if ($method !== 'GET' && $method !== 'HEAD') {
            return;
        }

        $response = $event->getResponse();
        $headers = $event->getResponse()->headers;

        // Imbo defaults to 'public' as cache-control value - if it has changed from this value,
        // assume the resource requested has explicitly defined its own caching rules and fall back
        if ($headers->get('Cache-Control') !== 'public') {
            return;
        }

        // Get configured HTTP cache defaults from configuration, then apply them
        $config = $event->getConfig()['httpCacheHeaders'];

        if (isset($config['maxAge'])) {
            $response->setMaxAge((int) $config['maxAge']);
        }

        if (isset($config['sharedMaxAge'])) {
            $response->setSharedMaxAge($config['sharedMaxAge']);
        }

        if (isset($config['public']) && $config['public']) {
            $response->setPublic();
        } else if (isset($config['public'])) {
            $response->setPrivate();
        }

        if (isset($config['mustRevalidate']) && $config['mustRevalidate']) {
            $headers->addCacheControlDirective('must-revalidate');
        }
    }
1116584
public function setReplaceFormKeyFlag($eventObject) {
        $esiHelper = Mage::helper('turpentine/esi');
        $varnishHelper = Mage::helper('turpentine/varnish');
        $request = Mage::app()->getRequest();
        if ($esiHelper->shouldResponseUseEsi() &&
                $varnishHelper->csrfFixupNeeded() &&
                ! $request->isPost()) {
            Mage::register('replace_form_key', true);
        }
    }
835573
public function dispatch($event, Event $eventObject)
    {
        if (!isset($this->listeners[$event])) {
            return;
        }
        
        foreach ($this->listeners[$event] as $listener) {
            call_user_func_array($listener, array($eventObject));
            
            if ($eventObject->propagationHalted()) {
                break;
            }
        }
    }
1355210
public function generateSite()
    {

        $template = new TemplateImpl($this->backendContainer);
        $pageStrategy = $this->backendContainer->getCurrentPageStrategyInstance();


        $cacheControl = $this->backendContainer->getCacheControlInstance();
        if ($this->config->isDebugMode()) {
            $cacheControl->disableCache();
            $template->setTwigDebug(true);
        }


        $currentPage = $pageStrategy->getCurrentPage();
        $template->setTemplateFromConfig($currentPage->getTemplate(), "_main");

        $ajaxServer = $this->backendContainer->getAJAXServerInstance();
        $id = null;
        if (($id = $this->GETValueOfIndexIfSetElseDefault('ajax')) !== null) {
            $template->onlyInitialize();
            $ajaxServer->registerHandlersFromConfig();
        }

        //Decide output mode
        if ($id !== null) {
            echo json_encode($ajaxServer->handleFromFunctionString($id, $this->GETValueOfIndexIfSetElseDefault('token')), $this->config->isDebugMode()?JSON_PRETTY_PRINT:0);

        } else if (!$cacheControl->setUpCache()) {
            echo $template->render();
        }

    }
727551
public function save(DomainObjectInterface &$domainObject): void
    {
        if ($domainObject->getId() === 0) {
            $this->concreteInsert($domainObject);
        }

        $this->concreteUpdate($domainObject);
    }
114673
protected function getFromCache($rootObject, $path)
    {
        $cacheId = $this->cacheId($rootObject, $path);

        return isset($this->typeCache[$cacheId]) ? $this->typeCache[$cacheId] : null;
    }
250314
public function set_security($securityobject) {
        if ($securityobject instanceof \core\files\curl_security_helper) {
            $this->securityhelper = $securityobject;
            return true;
        }
        return false;
    }
1052164
public function process($object, UriBuilder $uriBuilder, $metaDataProcessorGroup = NULL) {

		$formerConfigurationStackAttributes = array(
			'cacheTagService',
			'metaDataProcessors',
			'metaDataProcessorStorage',
			'uriBuilder',
			'propertyPath',
		);

		/*
		 * Remember previous state
		 */
		array_unshift($this->formerConfigurationStack, []);
		foreach ($formerConfigurationStackAttributes as $formerConfigurationStackAttribute) {
			$this->formerConfigurationStack[0][$formerConfigurationStackAttribute] = $this->{$formerConfigurationStackAttribute};
		}

		/*
		 * Initialize
		 */
		$this->uriBuilder = $uriBuilder;
		$this->propertyPath = [];
		$this->initializeMetaDataProcessors($metaDataProcessorGroup);

		/*
		if ($cacheTagService) {
			$this->cacheTagService = $cacheTagService;
			$this->cacheTagService->openEnvironment();
		}
		*/

		$result = $this->processInternal($object);
		$result = $this->applyMetaData($result, $object);

		/*
		if ($cacheTagService) {
			$this->cacheTagService->closeEnvironment();
			$this->cacheTagService = NULL;
		}
		*/

		/*
		 * Reset previous state
		 */
		foreach ($formerConfigurationStackAttributes as $formerConfigurationStackAttribute) {
			$this->{$formerConfigurationStackAttribute} = $this->formerConfigurationStack[0][$formerConfigurationStackAttribute];
		}
		array_shift($this->formerConfigurationStack);

		return $result;
	}
453166
protected function getListeners(Event $eventObject) {
        $listeners = $this->getOption(self::OPTION_LISTENERS);
        return isset($listeners[$eventObject->getName()])
            ? $listeners[$eventObject->getName()]
            : array();
    }
988789
public function persist(LdapObject $ldapObject)
    {
        if (empty($ldapObject->getBatchCollection()->toArray())) {
            return;
        }
        $this->dispatcher->dispatch(new LdapObjectEvent(Event::LDAP_OBJECT_BEFORE_MODIFY, $ldapObject));

        $this->validateObject($ldapObject);
        $this->executeBatchOperation($ldapObject);

        $this->dispatcher->dispatch(new LdapObjectEvent(Event::LDAP_OBJECT_AFTER_MODIFY, $ldapObject));
    }
1019281
public function inspect(Interfaces\JavaObject $javaObject): string
    {
        try {
            $inspect = $this->pjbProxyClient->inspect($javaObject);
        } catch (Pjb62BrokenConnectionException | Exception\InvalidUsageException $e) {
            PjbProxyClient::unregisterInstance();
            throw new BrokenConnectionException($e->getMessage(), $e->getCode(), $e);
        }

        return $inspect;
    }
1065550
public function postProcessContentObjectInitialization(ContentObjectRenderer &$parentObject)
    {
        if (!empty($parentObject->currentRecord)) {
            list($table) = explode(':', $parentObject->currentRecord);

            if (!empty($table) && $table != 'pages') {
                $this->findFrontendGroups($parentObject->data, $table);
            }
        }
    }
1010664
public final function setFetchObject(string $fetchObject): void
    {
        if (!class_exists($fetchObject)) {
            throw new InvalidValueException("Fetch object class '{$fetchObject}' not found!");
        }

        $this->fetchObject = $fetchObject;
    }
322016
public function queueAllUrls($eventObject) {
        $helper = Mage::helper('turpentine/cron');
        if ($helper->getCrawlerEnabled()) {
            $helper->addUrlsToCrawlerQueue($helper->getAllUrls());
        }
    }
616894
public function banMediaCache($eventObject) {
        if (Mage::helper('turpentine/varnish')->getVarnishEnabled()) {
            $result = $this->_getVarnishAdmin()->flushUrl('media/(?:js|css)/');
            Mage::dispatchEvent('turpentine_ban_media_cache', $result);
            $this->_checkResult($result);
        }
    }