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

PLANET-3419 - Enable Timber template caching #750

Merged
merged 3 commits into from Apr 10, 2019

Conversation

27Bslash6
Copy link
Contributor

Sets Timber::$cache to the inverse of WP_DEBUG

Enables Timber .twig > .php blob template caching for all non-development environments.

See: https://github.com/greenpeace/planet4-docker/blob/master/src/planet-4-151612/wordpress/wp-config.php.tmpl#L60

If APP_ENV matches develop then WP_DEBUG is true, therefore template caching is disabled and edits should be immediately visible without cache clear.

@27Bslash6 27Bslash6 requested a review from a team April 4, 2019 04:56
@pablocubico
Copy link
Contributor

Hey @27Bslash6 I tried this before for the search results, but couldn't really measure the performance impact locally.

Just a note: this adds a cache folder inside plugins/timber-library, do we need to clear that on production? maybe flushing the cache or something to make sure it picks up any change in the Twig files?

@27Bslash6
Copy link
Contributor Author

No there's no need to flush changes. Without any additional considerations, the containers will be deployed with blank timber cache folders and recreate them on first use.

Secondly, the helm charts have been adapted to mount this folder as tmpfs - a ramdrive which persists only as long as the container lifetime: https://github.com/greenpeace/planet4-helm-wordpress/blob/master/templates/deployment-php.yaml#L49

While you may not have been able to measure a difference, it's a recommended step for production anyway - there's no need for twig to recreate the php logic from twig on every pageview.

@koyan koyan changed the title Enable Timber template caching PLANET-3419 - Enable Timber template caching Apr 9, 2019
@koyan koyan changed the base branch from develop to release/v1.40.0 April 9, 2019 07:24
@koyan koyan changed the base branch from release/v1.40.0 to develop April 9, 2019 07:39
Copy link
Contributor

@pablocubico pablocubico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@27Bslash6 27Bslash6 merged commit 4c1b13e into develop Apr 10, 2019
@27Bslash6 27Bslash6 deleted the feature/timber-template-cache branch April 10, 2019 04:45
Copy link
Contributor

@angtheod angtheod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

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