Taking Caching to the Next Level (Symfony Live Session Notes)

Wayne Eaker
Taking Caching to the Next Level (Symfony Live Session Notes)

Session Link

Caching

  • 80% - 90% of web site response is on the front end.
  • This talk focuses on the other 10% - 20%.

Web Application Caching

  • Symfony's Route matcher is cached at application level
  • Container and Twig are also cached.
  • ORM: Metadata, Result and Query caches
  • Cache blocks in your template files
  • Lifetime caching: time-based caching
  • Generational caching: Make a unique key for item and block.
  • composer require asm89/twig-cache-extenstion

Varnish

  • Edge Side Includes
  • <esi:include src="https://www.drupaltutor.com/header" onerror="continue" />
  • Varnish will start returning data to user as soon as it has something. So, it allows slow loading pieces to come in later.
  • Different blocks can have different cache expiration times.
  • Varnish will skip caching requests with cookies in them.
  • Vary header: Vary: Cookie. Generation of caches based on user.
  • Vary: App-Group. Have to annotate the original request for this non-standard header.
  • Add an authentication app to generate the new request and calculate the App Group

Browser Cache

  • localStorage: ajax callback and store in localStorage for things like "Welcome username"