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

CacheWarmup missing? #63

Closed
rabauss opened this issue Aug 1, 2017 · 14 comments
Closed

CacheWarmup missing? #63

rabauss opened this issue Aug 1, 2017 · 14 comments
Labels

Comments

@rabauss
Copy link

rabauss commented Aug 1, 2017

We use isotope with contao 4 and now we had several problems with missing dca-files in cache after cache:clear. then isotope cannot load the relations correctly (isotope/core#1832).
after calling cache:warmup everything is fine because the cache is recreated.

so I researched in the code and found the 'cache_clearer' in the InstallationController. Now I understand, that after every Installation the problem occured.

Why is there no cache_warmer in the installation-bundle???

@fritzmg
Copy link
Contributor

fritzmg commented Aug 1, 2017

If the cache is cleared without warmup (clearing the cache with warmup is deprecated now), the cache should be automatically built on the next request.

@fritzmg
Copy link
Contributor

fritzmg commented Aug 1, 2017

There is a cache:warmup in the post-update and -install script of the manager-bundle: https://github.com/contao/manager-bundle/blob/4.4.2/src/Composer/ScriptHandler.php#L38

You are right though. Any time you open the install tool and login, the prod cache is deleted. I am not sure it is wise to do that in a regular request. How can one be sure that the cache is built within the same request again?

@rabauss
Copy link
Author

rabauss commented Aug 1, 2017

yes, i know that with warmup is deprecated.
in my installation the cachedir/contao/dca is not recreated after cache:clear

@fritzmg
Copy link
Contributor

fritzmg commented Aug 1, 2017

I can confirm that. The internal cache of Contao (config, dca, languages & sql) is not generated under the following circumstances:

  • Clearing the cache manually by deleting va/cache/prod and then making a front end or back end request.
  • Clearing the cache via cache:clear --no-warmup and then making a front end or back end request.

The internal Cache of Contao will only be generated when using either one of these commands:

  • cache:clear (deprecated)
  • cache:warmup

@fritzmg
Copy link
Contributor

fritzmg commented Aug 1, 2017

So may be it should be changed like this:

-            $this->container->get('cache_clearer')->clear($realCacheDir);
+            $this->container->get('cache_warmer')->warmUp($realCacheDir);

Unless clearing the cache is necessary before warmup - then just add the warmup after.

@aschempp
Copy link
Member

aschempp commented Aug 3, 2017

The Contao internal cache is optional, meaning Contao works without it (lower performance though). That's why the cache is not build if you simply clear it, which also helps with development because otherwise you would need to rebuild the cache on every file change.

Not sure what we do about the install tool though.

@leofeyer
Copy link
Member

leofeyer commented Aug 9, 2017

The internal Cache of Contao will only be generated when using either one of these commands:

  • cache:clear (deprecated)
  • cache:warmup

Yes, that is because the Contao cache warmer has been declared optional. @contao/developers Should we make the Contao cache warmer required?

@fritzmg
Copy link
Contributor

fritzmg commented Aug 9, 2017

Otherwise, whenever a user logs into the install tool, the internal cache of Contao will never be built, without the user knowing about it. Currently you have to execute cache:warmup manually after you used the install tool everytime.

And if you solely use the Contao Manager then your only option is doing a package update after using the install tool.

Which would result in quite a ridiculous workflow ;)

  1. Install an extension/bundle via the Contao Manager, which will run a composer update
  2. Open the install tool
  3. Run a composer update via the Contao Manager again

@aschempp
Copy link
Member

aschempp commented Aug 9, 2017 via email

@fritzmg
Copy link
Contributor

fritzmg commented Aug 9, 2017

Right, didn't notice that! But still, currently there is no feedback about whether or not the internal cache is built yet (like there used to in Contao 3).

@rabauss
Copy link
Author

rabauss commented Aug 10, 2017

if the cache is optional, so why is my isotope crashing with "field is not related"???

@Toflar
Copy link
Member

Toflar commented Aug 10, 2017

Because maybe Isotope is not correctly loading what it needs. If it relies on the cache to be present, this is a bug.

@leofeyer
Copy link
Member

As discussed in Mumble on August 10th, 2017, the install tool needs to warm up the cache.

@leofeyer
Copy link
Member

See #66.

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

5 participants