Chapters
24 Chapters
|
2:45:42
|
Login to bookmark this video
-
Course Code
Subscribe to download the code!Compatible PHP versions: >=5.5.9
Subscribe to download the code!Compatible PHP versions: >=5.5.9
-
This Video
Subscribe to download the video!
Subscribe to download the video!
-
Subtitles
Subscribe to download the subtitles!
Subscribe to download the subtitles!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
17.
Optimizing with Cache
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Subscribe to jump to this part in the video!
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
While the fundamentals of Ansistrano haven't changed, this tutorial is built using Symfony 3, which has significant differences versus Symfony 4 and later.
What PHP libraries does this tutorial use?
// composer.json
{
"require": {
"php": ">=5.5.9",
"doctrine/doctrine-bundle": "^1.6", // 1.6.8
"doctrine/orm": "^2.5", // v2.7.2
"incenteev/composer-parameter-handler": "^2.0", // v2.1.2
"sensio/distribution-bundle": "^5.0.19", // v5.0.20
"sensio/framework-extra-bundle": "^3.0.2", // v3.0.26
"symfony/monolog-bundle": "^3.1.0", // v3.1.0
"symfony/polyfill-apcu": "^1.0", // v1.4.0
"symfony/swiftmailer-bundle": "^2.3.10", // v2.6.3
"symfony/symfony": "3.3.*", // v3.3.5
"twig/twig": "^1.0||^2.0", // v1.34.4
"doctrine/doctrine-migrations-bundle": "^1.2", // v1.2.1
"predis/predis": "^1.1", // v1.1.1
"composer/package-versions-deprecated": "^1.11" // 1.11.99
},
"require-dev": {
"sensio/generator-bundle": "^3.0", // v3.1.6
"symfony/phpunit-bridge": "^3.0", // v3.3.5
"doctrine/data-fixtures": "^1.1", // 1.3.3
"hautelook/alice-bundle": "^1.3" // v1.4.1
}
}
What Ansible libraries does this tutorial use?
# ansible/requirements.yml
-
src: DavidWittman.redis
version: 1.2.4
-
src: ansistrano.deploy
version: 2.7.0
-
src: ansistrano.rollback
version: 2.0.1
2 Comments
Why we don't activate `result_cache_driver` ? what'is the difference between metadata_cache_driver and query_cache_driver ? For how can't install apcu, do you think using pool cache is a good idea ?
Hey ahmedbhs !
Excellent questions!
> Why we don't activate `result_cache_driver`
This activates the cache on a separate, optional caching system where Doctrine can cache the results of a query. Even if you activate this config, you still need to activate the cache on any queries where you want this - https://doctrine2.readthedo...
I don't use this feature because I just use Symfony's cache service whenever I want to cache anything (whether that's the result of something from the database or something else).
> what'is the difference between metadata_cache_driver and query_cache_driver?
It's subtle. The "metadata cache" basically caches the annotations that you have on your entities. The query cache caches the transformation from the DQL queries (which are also used with the query builder) into SQL. Both are things that it makes 100% sense to cache and not reset that cache until something in your code changes (e.g. on the next deploy).
> For how can't install apcu, do you think using pool cache is a good idea ?
What do you mean by a pool cache? Are you referring to Symfony's cache pools? If so, absolutely. The cache config I show here is a bit out-of-date. It works, but we've made it easier in newer versions of DoctrineBundle to use Symfony's cache instead. You can see a nice example in the recipe for DoctrineBundle - this is the config file for the "prod" environment: https://github.com/symfony/...
Cheers!
"Houston: no signs of life"
Start the conversation!