SlideShare ist ein Scribd-Unternehmen logo
1 von 38
Downloaden Sie, um offline zu lesen
Presentation title here
Data Cache Management
in PHP
Presentation title here
About me
https://www.facebook.com/yatsenco
https://github.com/anyt
about me…
Andrey Yatsenco
● PHP Developer at Oro Inc.
● 3 years with Symfony
● 6 years with PHP
Presentation title here
Data Cache Management in PHP
In this presentation
● Everything about cache
● Full-page cache
● Browser cache. HTTP cache
● Basics about cache
● About data cache
● Common pitfalls
Presentation title here
Data Cache Management in PHP
Cache is the temporary storage where
frequently asked or expensive computed data
can be stored for faster access
Presentation title here
Data Cache Management in PHP
Caching concepts
● Unique cache key
● Lifetime
● Clearing cache data by key
Presentation title here
Data Cache Management in PHP
Cache key
● All data identified by the key
● Key should be unique systemwide
● It’s good idea to use key prefixes
(namespaces)
○ Application namespace
○ Specific data namespace
Presentation title here
Data Cache Management in PHP
Lifetime (TTL)
● Expiration DateTime
● In seconds from save
○ internally DateTime used too
Presentation title here
Data Cache Management in PHP
Clearing cache data by key:
● Key should be unique
● Cache systems should provide ability to
delete data by key
Presentation title here
Data Cache Management in PHP
Why to cache?
● Reduce number of requests to database
● Reduce number of requests to external
resources (API, etc)
● Reduce number of requests to slow storage
(like file system)
● Reduce expensive computing data
recalculation
● You suppose to have high load
Presentation title here
Data Cache Management in PHP
Cache alternatives?
● Code refactoring
Presentation title here
Data Cache Management in PHP
Cache strategies:
● Frontend cache
● Backend cache
Presentation title here
Data Cache Management in PHP
Frontend Cache strategies:
● Page cache in browser
● Offline website cache
● Data cache
○ Cookie
○ Local Storage
Presentation title here
Data Cache Management in PHP
Backend Cache strategies:
● Entire page cache
● Parts of the page
● Opcode-cache
● Store sql-queries result
● Store complex php computing result
● You custom
Presentation title here
Data Cache Management in PHP
In Symfony before using data cache, it’s good
idea to enable default cache that works out of
the box
Presentation title here
Data Cache Management in PHP
Quick speed up Symfony application:
● Production mode for AppKernel
● use AppCache in front controller
● Doctrine Metadata cache
● Doctrine Query cache (not query result)
● composer dump-autoload --optimize
● Enable OpCode cache
Presentation title here
Data Cache Management in PHP
Next: Symfony HTTP cache for shared
pages:
Based on HTTP request headers
● Reverse proxy cache
● ESI cache
● Browser cache
http://symfony.com/doc/current/book/http_cache.html
Presentation title here
Data Cache Management in PHP
When to use Data cache?
● Displays different
Presentation title here
Data Cache Management in PHP
Doctrine Query Result cache
● You need to configure it per query
Presentation title here
Data Cache Management in PHP
Doctrine Query Result cache
● Clearing cache by ID
Presentation title here
Data Cache Management in PHP
Custom Data Cache
● Expensive data computing
● External resources results
● Your custom data
Presentation title here
Data Cache Management in PHP
Custom Data Cache
● Doctrine Cache component
● Symfony 3.1 Cache component (PSR-6)
● PHP-Cache (PSR-6 + steroids)
Presentation title here
Data Cache Management in PHP
Doctrine Cache component
● Use DoctrineCacheBundle to connect
with Symfony '< 3.1'
● Used internally in Doctrine ORM
● Can be used without Doctrine ORM at all
Presentation title here
Data Cache Management in PHP
Doctrine Cache component
Supported providers:
● APC
● CouchBase
● Filesystem
● MongoDB
● Memcache
● Memcached
● Redis
● Riak
● SQLite3
● WinCache
● xCache
● Zend Data Cache
Presentation title here
Data Cache Management in PHP
Doctrine Cache component
Supported providers:
● Array
○ In memory cache that resets every request
● Chain
○ Chain of several caches, from fast and expensive to slow and cheap
Presentation title here
Data Cache Management in PHP
Doctrine Cache component usage example:
Presentation title here
PSR-6 standard
The goal of this PSR is to allow developers to
create cache-aware libraries that can be
integrated into existing frameworks and
systems without the need for custom
development.
Data Cache Management in PHP
Presentation title here
PSR-6 standard
Key concepts:
● Items
● Pool
Data Cache Management in PHP
Presentation title here
Data Cache Management in PHP
PSR-6 standard
Presentation title here
Data Cache Management in PHP
PSR-6 standard
Presentation title here
Data Cache Management in PHP
Symfony cache component (from SF3.1)
https://github.com/symfony/cache
● Strict PSR-6 implementation
● Very simple and fast
● Has doctrine/cache proxy adapter for
advanced features
Presentation title here
Extra cache features
● Tags
○ Tags is used to control the invalidation of items.
● Hierarchy
○ Think of a hierarchy like a file system. If you remove a folder "Foo",
all items and folders in "Foo" will also be removed
Data Cache Management in PHP
Presentation title here
Extra cache features
● Tags
● Hierarchy
Not supported by doctrine or symfony cache
components
● Perhaps will be implemented in
doctrine/cache 2.0
Data Cache Management in PHP
Presentation title here
Extra cache features
● Tags
● Hierarchy
PHP-Cache library (PSR-6)
php-cache.com
Data Cache Management in PHP
Presentation title here
PHP-Cache Tags usage example:
Data Cache Management in PHP
Presentation title here
PHP-Cache Hierarchy usage example:
Data Cache Management in PHP
Presentation title here
Data Cache Management in PHP
Pitfalls
● Premature optimization
● Caching only optimization
● Inability to easy invalidate cache item
● Cache slam
● Relying on cache data
● Inconsistency
● Cache works slower then cache target
Presentation title here
Data Cache Management in PHP
Links:
Psr-6
● www.php-fig.org/psr/psr-6/
Doctrine cache
● http://doctrine-orm.readthedocs.io/projects/doctrine-orm/en/latest/reference/caching.html
● http://symfony.com/doc/current/bundles/DoctrineCacheBundle/index.html
Symfony cache component
● https://github.com/symfony/cache
PHP-Cache project
● http://www.php-cache.com/en/latest/
Sergey Zhuravel presentation about scalability:
● http://www.slideshare.net/sergeyz/scalability-58564573
Vitaly Berdylo presentation about Symfony Performance
● http://www.slideshare.net/vitaliyberdylo/symfony2-performance-issues-and-improvements
Presentation title here
?

Weitere ähnliche Inhalte

Was ist angesagt?

Memcache and Drupal - Vaibhav Jain
Memcache and Drupal - Vaibhav JainMemcache and Drupal - Vaibhav Jain
Memcache and Drupal - Vaibhav JainDrupal Camp Delhi
 
The Render API in Drupal 7
The Render API in Drupal 7The Render API in Drupal 7
The Render API in Drupal 7frandoh
 
Drupal caching
Drupal cachingDrupal caching
Drupal cachingExove
 
Extending Zend Framework
Extending Zend FrameworkExtending Zend Framework
Extending Zend FrameworkPHPBelgium
 
Object Relational Mapping in PHP
Object Relational Mapping in PHPObject Relational Mapping in PHP
Object Relational Mapping in PHPRob Knight
 
Zend Con 2008 Slides
Zend Con 2008 SlidesZend Con 2008 Slides
Zend Con 2008 Slidesmkherlakian
 
PHP language presentation
PHP language presentationPHP language presentation
PHP language presentationAnnujj Agrawaal
 
Html5三种本地存储方式的比较
Html5三种本地存储方式的比较Html5三种本地存储方式的比较
Html5三种本地存储方式的比较sunnylqm
 
Archiving in eZ Publish: What to do with all your content
Archiving in eZ Publish: What to do with all your contentArchiving in eZ Publish: What to do with all your content
Archiving in eZ Publish: What to do with all your contentPeter Keung
 
Hadoop & Zing
Hadoop & ZingHadoop & Zing
Hadoop & ZingLong Dao
 
Caching in Drupal 8
Caching in Drupal 8Caching in Drupal 8
Caching in Drupal 8valuebound
 
Lcna tutorial-2012
Lcna tutorial-2012Lcna tutorial-2012
Lcna tutorial-2012Gluster.org
 
Hong Kong Drupal User Group - Sep 13th
Hong Kong Drupal User Group - Sep 13thHong Kong Drupal User Group - Sep 13th
Hong Kong Drupal User Group - Sep 13thWong Hoi Sing Edison
 

Was ist angesagt? (20)

php
phpphp
php
 
Memcache and Drupal - Vaibhav Jain
Memcache and Drupal - Vaibhav JainMemcache and Drupal - Vaibhav Jain
Memcache and Drupal - Vaibhav Jain
 
Introduction to Web Designing
Introduction to Web DesigningIntroduction to Web Designing
Introduction to Web Designing
 
Html
HtmlHtml
Html
 
The Render API in Drupal 7
The Render API in Drupal 7The Render API in Drupal 7
The Render API in Drupal 7
 
Drupal caching
Drupal cachingDrupal caching
Drupal caching
 
Extending Zend Framework
Extending Zend FrameworkExtending Zend Framework
Extending Zend Framework
 
Object Relational Mapping in PHP
Object Relational Mapping in PHPObject Relational Mapping in PHP
Object Relational Mapping in PHP
 
Zend Con 2008 Slides
Zend Con 2008 SlidesZend Con 2008 Slides
Zend Con 2008 Slides
 
PHP language presentation
PHP language presentationPHP language presentation
PHP language presentation
 
Dom parser
Dom parserDom parser
Dom parser
 
Xml
XmlXml
Xml
 
Storage in hadoop
Storage in hadoopStorage in hadoop
Storage in hadoop
 
Html5三种本地存储方式的比较
Html5三种本地存储方式的比较Html5三种本地存储方式的比较
Html5三种本地存储方式的比较
 
Archiving in eZ Publish: What to do with all your content
Archiving in eZ Publish: What to do with all your contentArchiving in eZ Publish: What to do with all your content
Archiving in eZ Publish: What to do with all your content
 
Hadoop & Zing
Hadoop & ZingHadoop & Zing
Hadoop & Zing
 
Caching in Drupal 8
Caching in Drupal 8Caching in Drupal 8
Caching in Drupal 8
 
Lcna tutorial-2012
Lcna tutorial-2012Lcna tutorial-2012
Lcna tutorial-2012
 
Hong Kong Drupal User Group - Sep 13th
Hong Kong Drupal User Group - Sep 13thHong Kong Drupal User Group - Sep 13th
Hong Kong Drupal User Group - Sep 13th
 
Php File Upload
Php File UploadPhp File Upload
Php File Upload
 

Ähnlich wie Data cache management in php

Silverstripe at scale - design & architecture for silverstripe applications
Silverstripe at scale - design & architecture for silverstripe applicationsSilverstripe at scale - design & architecture for silverstripe applications
Silverstripe at scale - design & architecture for silverstripe applicationsBrettTasker
 
InterConPHP 2014 - Scaling PHP
InterConPHP 2014 - Scaling PHPInterConPHP 2014 - Scaling PHP
InterConPHP 2014 - Scaling PHPLucas Arruda
 
Optimizing public facing SharePoint sites
Optimizing public facing SharePoint sitesOptimizing public facing SharePoint sites
Optimizing public facing SharePoint sitesGunnar Peipman
 
Escalando php e drupal- performance ao infinito e além! - DrupalCamp SP 2015
Escalando php e drupal- performance ao infinito e além! - DrupalCamp SP 2015Escalando php e drupal- performance ao infinito e além! - DrupalCamp SP 2015
Escalando php e drupal- performance ao infinito e além! - DrupalCamp SP 2015Handrus Nogueira
 
DrupalCamp SP 2015 - Escalando PHP e Drupal- Performance ao infinito e além!
DrupalCamp SP 2015 -  Escalando PHP e Drupal- Performance ao infinito e além!DrupalCamp SP 2015 -  Escalando PHP e Drupal- Performance ao infinito e além!
DrupalCamp SP 2015 - Escalando PHP e Drupal- Performance ao infinito e além!Taller Negócio Digitais
 
Escalando php e drupal- performance ao infinito e além! - Drupal camp sp 2015
Escalando php e drupal- performance ao infinito e além! - Drupal camp sp 2015Escalando php e drupal- performance ao infinito e além! - Drupal camp sp 2015
Escalando php e drupal- performance ao infinito e além! - Drupal camp sp 2015Handrus Nogueira
 
ASP.NET 4.0 Cache Extensibility
ASP.NET 4.0 Cache ExtensibilityASP.NET 4.0 Cache Extensibility
ASP.NET 4.0 Cache Extensibilityakrakovetsky
 
Nginx [engine x] and you (and WordPress)
Nginx [engine x] and you (and WordPress)Nginx [engine x] and you (and WordPress)
Nginx [engine x] and you (and WordPress)Justin Foell
 
phptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorialphptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorialWim Godden
 
Journey through high performance django application
Journey through high performance django applicationJourney through high performance django application
Journey through high performance django applicationbangaloredjangousergroup
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalabilityWim Godden
 

Ähnlich wie Data cache management in php (20)

PHP Profiling/performance
PHP Profiling/performancePHP Profiling/performance
PHP Profiling/performance
 
Silverstripe at scale - design & architecture for silverstripe applications
Silverstripe at scale - design & architecture for silverstripe applicationsSilverstripe at scale - design & architecture for silverstripe applications
Silverstripe at scale - design & architecture for silverstripe applications
 
Caching in drupal
Caching in drupalCaching in drupal
Caching in drupal
 
Scaling PHP apps
Scaling PHP appsScaling PHP apps
Scaling PHP apps
 
Caching in WordPress
Caching in WordPressCaching in WordPress
Caching in WordPress
 
InterConPHP 2014 - Scaling PHP
InterConPHP 2014 - Scaling PHPInterConPHP 2014 - Scaling PHP
InterConPHP 2014 - Scaling PHP
 
Optimizing public facing SharePoint sites
Optimizing public facing SharePoint sitesOptimizing public facing SharePoint sites
Optimizing public facing SharePoint sites
 
Escalando php e drupal- performance ao infinito e além! - DrupalCamp SP 2015
Escalando php e drupal- performance ao infinito e além! - DrupalCamp SP 2015Escalando php e drupal- performance ao infinito e além! - DrupalCamp SP 2015
Escalando php e drupal- performance ao infinito e além! - DrupalCamp SP 2015
 
DrupalCamp SP 2015 - Escalando PHP e Drupal- Performance ao infinito e além!
DrupalCamp SP 2015 -  Escalando PHP e Drupal- Performance ao infinito e além!DrupalCamp SP 2015 -  Escalando PHP e Drupal- Performance ao infinito e além!
DrupalCamp SP 2015 - Escalando PHP e Drupal- Performance ao infinito e além!
 
Escalando php e drupal- performance ao infinito e além! - Drupal camp sp 2015
Escalando php e drupal- performance ao infinito e além! - Drupal camp sp 2015Escalando php e drupal- performance ao infinito e além! - Drupal camp sp 2015
Escalando php e drupal- performance ao infinito e além! - Drupal camp sp 2015
 
ASP.NET 4.0 Cache Extensibility
ASP.NET 4.0 Cache ExtensibilityASP.NET 4.0 Cache Extensibility
ASP.NET 4.0 Cache Extensibility
 
Nginx [engine x] and you (and WordPress)
Nginx [engine x] and you (and WordPress)Nginx [engine x] and you (and WordPress)
Nginx [engine x] and you (and WordPress)
 
Asp.net caching
Asp.net cachingAsp.net caching
Asp.net caching
 
Nginx pres
Nginx presNginx pres
Nginx pres
 
phptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorialphptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorial
 
Journey through high performance django application
Journey through high performance django applicationJourney through high performance django application
Journey through high performance django application
 
Tachyon workshop 2015-07-19
Tachyon workshop 2015-07-19Tachyon workshop 2015-07-19
Tachyon workshop 2015-07-19
 
sample1
sample1sample1
sample1
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
Html5 web storage
Html5 web storageHtml5 web storage
Html5 web storage
 

Mehr von Andrew Yatsenko

Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020
Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020
Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020Andrew Yatsenko
 
OroCommerce Storefront Design. Non-standard Layout Customisation.
OroCommerce Storefront Design. Non-standard Layout Customisation.OroCommerce Storefront Design. Non-standard Layout Customisation.
OroCommerce Storefront Design. Non-standard Layout Customisation.Andrew Yatsenko
 
Gear Up for OroPlatform 4.1 LTS. Dependency Injection Improvements Overview ...
Gear Up for OroPlatform 4.1 LTS.  Dependency Injection Improvements Overview ...Gear Up for OroPlatform 4.1 LTS.  Dependency Injection Improvements Overview ...
Gear Up for OroPlatform 4.1 LTS. Dependency Injection Improvements Overview ...Andrew Yatsenko
 
Effectively Reuse the Code Between PHP Projects
Effectively Reuse the Code Between PHP ProjectsEffectively Reuse the Code Between PHP Projects
Effectively Reuse the Code Between PHP ProjectsAndrew Yatsenko
 
Performance profiling and testing of symfony application 2
Performance profiling and testing of symfony application 2Performance profiling and testing of symfony application 2
Performance profiling and testing of symfony application 2Andrew Yatsenko
 
Doctrine Internals. UnitOfWork
Doctrine Internals. UnitOfWorkDoctrine Internals. UnitOfWork
Doctrine Internals. UnitOfWorkAndrew Yatsenko
 
Writing extensible applications
Writing extensible applicationsWriting extensible applications
Writing extensible applicationsAndrew Yatsenko
 
Symfony Form Basics - OroMeetup #3 Cherkassy
Symfony Form Basics - OroMeetup #3 CherkassySymfony Form Basics - OroMeetup #3 Cherkassy
Symfony Form Basics - OroMeetup #3 CherkassyAndrew Yatsenko
 

Mehr von Andrew Yatsenko (10)

Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020
Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020
Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020
 
OroCommerce Storefront Design. Non-standard Layout Customisation.
OroCommerce Storefront Design. Non-standard Layout Customisation.OroCommerce Storefront Design. Non-standard Layout Customisation.
OroCommerce Storefront Design. Non-standard Layout Customisation.
 
Gear Up for OroPlatform 4.1 LTS. Dependency Injection Improvements Overview ...
Gear Up for OroPlatform 4.1 LTS.  Dependency Injection Improvements Overview ...Gear Up for OroPlatform 4.1 LTS.  Dependency Injection Improvements Overview ...
Gear Up for OroPlatform 4.1 LTS. Dependency Injection Improvements Overview ...
 
Make the most of twig
Make the most of twigMake the most of twig
Make the most of twig
 
Effectively Reuse the Code Between PHP Projects
Effectively Reuse the Code Between PHP ProjectsEffectively Reuse the Code Between PHP Projects
Effectively Reuse the Code Between PHP Projects
 
Performance profiling and testing of symfony application 2
Performance profiling and testing of symfony application 2Performance profiling and testing of symfony application 2
Performance profiling and testing of symfony application 2
 
Using Oro layouts
Using Oro layoutsUsing Oro layouts
Using Oro layouts
 
Doctrine Internals. UnitOfWork
Doctrine Internals. UnitOfWorkDoctrine Internals. UnitOfWork
Doctrine Internals. UnitOfWork
 
Writing extensible applications
Writing extensible applicationsWriting extensible applications
Writing extensible applications
 
Symfony Form Basics - OroMeetup #3 Cherkassy
Symfony Form Basics - OroMeetup #3 CherkassySymfony Form Basics - OroMeetup #3 Cherkassy
Symfony Form Basics - OroMeetup #3 Cherkassy
 

Kürzlich hochgeladen

On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024APNIC
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$kojalkojal131
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebJames Anderson
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxellan12
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableSeo
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...tanu pandey
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Standkumarajju5765
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...Escorts Call Girls
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663Call Girls Mumbai
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.soniya singh
 
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Onlineanilsa9823
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Servicesexy call girls service in goa
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersDamian Radcliffe
 

Kürzlich hochgeladen (20)

On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
Russian Call Girls in %(+971524965298  )#  Call Girls in DubaiRussian Call Girls in %(+971524965298  )#  Call Girls in Dubai
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
 
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
 
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
 
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
 
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 

Data cache management in php

  • 1. Presentation title here Data Cache Management in PHP
  • 2. Presentation title here About me https://www.facebook.com/yatsenco https://github.com/anyt about me… Andrey Yatsenco ● PHP Developer at Oro Inc. ● 3 years with Symfony ● 6 years with PHP
  • 3. Presentation title here Data Cache Management in PHP In this presentation ● Everything about cache ● Full-page cache ● Browser cache. HTTP cache ● Basics about cache ● About data cache ● Common pitfalls
  • 4. Presentation title here Data Cache Management in PHP Cache is the temporary storage where frequently asked or expensive computed data can be stored for faster access
  • 5. Presentation title here Data Cache Management in PHP Caching concepts ● Unique cache key ● Lifetime ● Clearing cache data by key
  • 6. Presentation title here Data Cache Management in PHP Cache key ● All data identified by the key ● Key should be unique systemwide ● It’s good idea to use key prefixes (namespaces) ○ Application namespace ○ Specific data namespace
  • 7. Presentation title here Data Cache Management in PHP Lifetime (TTL) ● Expiration DateTime ● In seconds from save ○ internally DateTime used too
  • 8. Presentation title here Data Cache Management in PHP Clearing cache data by key: ● Key should be unique ● Cache systems should provide ability to delete data by key
  • 9. Presentation title here Data Cache Management in PHP Why to cache? ● Reduce number of requests to database ● Reduce number of requests to external resources (API, etc) ● Reduce number of requests to slow storage (like file system) ● Reduce expensive computing data recalculation ● You suppose to have high load
  • 10. Presentation title here Data Cache Management in PHP Cache alternatives? ● Code refactoring
  • 11. Presentation title here Data Cache Management in PHP Cache strategies: ● Frontend cache ● Backend cache
  • 12. Presentation title here Data Cache Management in PHP Frontend Cache strategies: ● Page cache in browser ● Offline website cache ● Data cache ○ Cookie ○ Local Storage
  • 13. Presentation title here Data Cache Management in PHP Backend Cache strategies: ● Entire page cache ● Parts of the page ● Opcode-cache ● Store sql-queries result ● Store complex php computing result ● You custom
  • 14. Presentation title here Data Cache Management in PHP In Symfony before using data cache, it’s good idea to enable default cache that works out of the box
  • 15. Presentation title here Data Cache Management in PHP Quick speed up Symfony application: ● Production mode for AppKernel ● use AppCache in front controller ● Doctrine Metadata cache ● Doctrine Query cache (not query result) ● composer dump-autoload --optimize ● Enable OpCode cache
  • 16. Presentation title here Data Cache Management in PHP Next: Symfony HTTP cache for shared pages: Based on HTTP request headers ● Reverse proxy cache ● ESI cache ● Browser cache http://symfony.com/doc/current/book/http_cache.html
  • 17. Presentation title here Data Cache Management in PHP When to use Data cache? ● Displays different
  • 18. Presentation title here Data Cache Management in PHP Doctrine Query Result cache ● You need to configure it per query
  • 19. Presentation title here Data Cache Management in PHP Doctrine Query Result cache ● Clearing cache by ID
  • 20. Presentation title here Data Cache Management in PHP Custom Data Cache ● Expensive data computing ● External resources results ● Your custom data
  • 21. Presentation title here Data Cache Management in PHP Custom Data Cache ● Doctrine Cache component ● Symfony 3.1 Cache component (PSR-6) ● PHP-Cache (PSR-6 + steroids)
  • 22. Presentation title here Data Cache Management in PHP Doctrine Cache component ● Use DoctrineCacheBundle to connect with Symfony '< 3.1' ● Used internally in Doctrine ORM ● Can be used without Doctrine ORM at all
  • 23. Presentation title here Data Cache Management in PHP Doctrine Cache component Supported providers: ● APC ● CouchBase ● Filesystem ● MongoDB ● Memcache ● Memcached ● Redis ● Riak ● SQLite3 ● WinCache ● xCache ● Zend Data Cache
  • 24. Presentation title here Data Cache Management in PHP Doctrine Cache component Supported providers: ● Array ○ In memory cache that resets every request ● Chain ○ Chain of several caches, from fast and expensive to slow and cheap
  • 25. Presentation title here Data Cache Management in PHP Doctrine Cache component usage example:
  • 26. Presentation title here PSR-6 standard The goal of this PSR is to allow developers to create cache-aware libraries that can be integrated into existing frameworks and systems without the need for custom development. Data Cache Management in PHP
  • 27. Presentation title here PSR-6 standard Key concepts: ● Items ● Pool Data Cache Management in PHP
  • 28. Presentation title here Data Cache Management in PHP PSR-6 standard
  • 29. Presentation title here Data Cache Management in PHP PSR-6 standard
  • 30. Presentation title here Data Cache Management in PHP Symfony cache component (from SF3.1) https://github.com/symfony/cache ● Strict PSR-6 implementation ● Very simple and fast ● Has doctrine/cache proxy adapter for advanced features
  • 31. Presentation title here Extra cache features ● Tags ○ Tags is used to control the invalidation of items. ● Hierarchy ○ Think of a hierarchy like a file system. If you remove a folder "Foo", all items and folders in "Foo" will also be removed Data Cache Management in PHP
  • 32. Presentation title here Extra cache features ● Tags ● Hierarchy Not supported by doctrine or symfony cache components ● Perhaps will be implemented in doctrine/cache 2.0 Data Cache Management in PHP
  • 33. Presentation title here Extra cache features ● Tags ● Hierarchy PHP-Cache library (PSR-6) php-cache.com Data Cache Management in PHP
  • 34. Presentation title here PHP-Cache Tags usage example: Data Cache Management in PHP
  • 35. Presentation title here PHP-Cache Hierarchy usage example: Data Cache Management in PHP
  • 36. Presentation title here Data Cache Management in PHP Pitfalls ● Premature optimization ● Caching only optimization ● Inability to easy invalidate cache item ● Cache slam ● Relying on cache data ● Inconsistency ● Cache works slower then cache target
  • 37. Presentation title here Data Cache Management in PHP Links: Psr-6 ● www.php-fig.org/psr/psr-6/ Doctrine cache ● http://doctrine-orm.readthedocs.io/projects/doctrine-orm/en/latest/reference/caching.html ● http://symfony.com/doc/current/bundles/DoctrineCacheBundle/index.html Symfony cache component ● https://github.com/symfony/cache PHP-Cache project ● http://www.php-cache.com/en/latest/ Sergey Zhuravel presentation about scalability: ● http://www.slideshare.net/sergeyz/scalability-58564573 Vitaly Berdylo presentation about Symfony Performance ● http://www.slideshare.net/vitaliyberdylo/symfony2-performance-issues-and-improvements