Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no_cache param in autoconfiguration #404

Closed
gilbertsoft opened this issue Feb 13, 2017 · 5 comments
Closed

no_cache param in autoconfiguration #404

gilbertsoft opened this issue Feb 13, 2017 · 5 comments
Labels

Comments

@gilbertsoft
Copy link
Contributor

Why don't you add no_cache param in autoconfig as you do with languages or domains?

I had the case after updating boostrap_package from 6 to 7 that this config was deleted after refreshing the autoconfig of realurl because boostrap_package 7 not longer sets this for the moment.

Here is the example what they did at version 6.2.10 onwards:

    $params['config']['preVars'] = array(
        '0' => array(
            'GETvar' => 'no_cache',
            'valueMap' => array(
                'nc' => '1',
            ),
            'noMatch' => 'bypass'
        ),
    );
@dmitryd
Copy link
Owner

dmitryd commented Feb 20, 2017

Because you should no use no_cache anywhere in production. Your code should use non-cacheable actions or plugins instead.

@gilbertsoft
Copy link
Contributor Author

Ok, thanks for the infos. It's already done with non-cachable actions but the no_cache param is added too what's not necessary as you say.

Is this a valid statement for every TYPO3 version from 6.2 up to 8?

@dmitryd
Copy link
Owner

dmitryd commented Feb 20, 2017

If you use no_cache, you force the following to happen:

  1. All typoscript is parsed (text parsing)
  2. All fluid templates are parsed
  3. All plugins are executed
  4. All content is assembled to the page

If you just use uncached action, the following happens:

  1. Content is fetched from the cache
  2. Content for the non-cache plugins is generated and substituted in the previously cached content

You can decide what is better :)

no_cache is evil (in general).

@gilbertsoft
Copy link
Contributor Author

gilbertsoft commented Feb 20, 2017

Yes, normally clear, but we have a special case, it's used with page types e.g. to get the stock for products or a status answer from a payment provider (text and json request and responses) and there is no other content on the page, only the plugin with a non-cacheable action. I had a look at the code generating the urls to this page (with examples in the urilBuilder params):

	$this->uriBuilder
		->reset()
		->setTargetPageUid( $target )
		->setCreateAbsoluteUri( true || false )
		->setTargetPageType( 191351524 || 191351525 )
		->setUseCacheHash( false )
		->setNoCache( false )
		->setArguments( $params );

This code generates a no_cache=1 param. Is this wrong or possible in that special case?

@gilbertsoft
Copy link
Contributor Author

I deactivated all no_cache settings and tested with non-cachable actions only and everything worked fine. Thanks for your support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants