Closed MikeDombo closed 7 years ago
Hi, Sorry to hear you get such trouble.
We have a big plan #168 and talk a lot about it in our slack to improve performance, but our priority will still be the cached version, the next version cache should provide faster cached templates rendering than pug-php 2.
I would far prefer to help to get the cache working than provide feature to work around the cache system.
The best practice is:
true
, cache should be false
false
, cache should be a writable path, and ideally upToDateCheck should be false# Download your project from a working repository
git clone https://repository-url.git projectDirectory
cd projectDirectory
# Get the last tag
git checkout tags/1.0.0
# Install composer dependencies
composer install
# Your specific deployment script
php deployment.php
# Save previous state
gzip -c -r /var/www/project > /home/archives/2017-10-27-15-04-48.gz
# Move the new project to the server
mv projectDirectory/* /var/www/project/
Here there is deployment.php
where you can do ->cacheDirectory
and everything you need on deployment. It can be as long as needed since nothing will be live until you execute the last command (mv
) which should be very fast. And as you would not edit /var/www/project/ templates without your automated deployment, there is no need for up-to-date check. This way every user in production always load cached versions and no one never get slower page rendering since you do not cache during a request process but during the deployment process.
So such option for ->cacheDirectory
could be interesting to fasten the deployment process. But you certainly not should call ->cacheDirectory
with or without such option during a page request rendering of a real user in your production environment.
Thanks for your reply. I'll follow that issue you posted and I will consider adding that code to my deployment process so that it does not have to render the pug at the time that a user requests the page.
Hi, I just switched to version 3 and found that the performance was greatly decreased compared to version 2. I never used caching before, but now with version 3 it seems necessary. The readme says that I can run a command to cache all templates, but that this should only be run once.
It would be great to have an option so that the cacheDirectory function will check and not recompile templates that are not updated. This would be the same as "upToDateCheck" in the render functions. In this way, the very first time it is run it will be quite slow, but every request afterward will be quick and will also keep the cache up to date with the current templates.