SlideShare una empresa de Scribd logo
1 de 58
eZ Partner Conference in Lisbon. Feb 9th



eZ Publish Caching
   Mechanisms
    // SPICY DETAILS


                Gilles Guirand
          CTO Kaliop / platinum partner
            eZ Publish board member
                    @gandbox
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   SUMMARY
   CONTEXT
   INI CACHE
   TEMPLATE COMPILATION
   VIEWCACHE
   CACHE-BLOCK
   EXPIRY.PHP FILE
   EZCACHE.PHP SCRIPT
   QUESTIONS
                                                     2 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   SUMMARY
   CONTEXT
   INI CACHE
   TEMPLATE COMPILATION
   VIEWCACHE
   CACHE-BLOCK
   EXPIRY.PHP FILE
   EZCACHE.PHP SCRIPT
   QUESTIONS




                                                     3 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   CONTEXT
   Common questions ( high trafic ) :
    ➔Is it possible to never expire the ENTIRE viewcache ?
   … and which actions actually expire the ENTIRE viewcache ?

    ➔   Is it possible to reduce the I/O (template-blocks) ?

    ➔   Is it possible to expire a specific set of viewcache ?

    ➔   Is it possible to expire a specific set ot template-block
        files ?

    ➔   Is there a best practice to PUSH a daily templates update ?

                                                                    4 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   CONTEXT
   Final questions :
    ➔  How all these cache mechanisms really work ?
   … I mean in details... algorithms, I/O, triggers, exceptions,
   undocumented features & settings, unknown bugs, unknown
   fixes...

   Final solutions :
    ➔   Don't trust the documentation : READ THE KERNEL / TEST THE
        KERNEL... ( be brave )



                                                                5 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   CONTEXT
   Knowledge exploitation / reuse :
    ➔   Write a FR document (46 pages) : mix between a
        documentation & tuto

    ➔   Publish it on differents supports (FR + EN)

    ➔   Split the article into 4 parts :

        1                  2                3           4



   INI                   VIEWCACHE         Template-   expiry.php
   Tpl compilation                         block       ezcache.php
                                                       bench
                                                                     6 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


      CONTEXT
      Publication schedule :

                            FEB         MARCH   APRIL   MAY   JUNE

                               1         2        3      4
                    FR


                                         1        2      3      4
gandbox.fr          FR


share.ez.no EN                           1        2      3      4
 ➔   (depending of translation delay)




                                                                     7 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   SUMMARY
   CONTEXT

   INI CACHE
   TEMPLATE COMPILATION
   VIEWCACHE
   CACHE-BLOCK
   EXPIRY.PHP FILE
   EZCACHE.PHP SCRIPT
   QUESTIONS




                                                     8 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   INI CACHE
   When eZ generates the INI cache ?
     ➔   On the fly (if the cache file does not exist) – from an API
         call (ezini PHP class), a template call (ezini operator)

     ➔   By default, eZ automatically check if an INI file has been
         changed or not, depending of this setting (config.php)

   //define( 'EZP_INI_FILEMTIME_CHECK', false ) ;

   /* Set EZP_INI_FILEMTIME_CHECK constant to false to improve performance
   ( 10% ~ 15% on I/O ) by not checking modified time on ini files. You can also set
   it to a string, the name of a ini file you still want to check modified time on, best
   example would be to set it to 'site.ini' to make the system still check that but
   not the rest. */

                                                                                       9 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   INI CACHE
   How eZ stores the INI cache ?
    ➔   var/cache/ini ( and not /{varDir}/ini ), not clusterized

    ➔{inifilename}-{hash}.php
   design-677247a49e428aa083741  1b52777b920.php
   design-704216b4d0e3ea68c09742504bb366c8.php
   design-7333039e7e19aa41  1f8dd01836555861.php
                                  md5

     FileName / RootDir / DirectAccess / overrideDirs /
                     internalCharset



                                                                   10 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   INI CACHE
   How to expire the INI cache ?
   ➔php bin/php/ezcache.php --clear-id=global_ini
    ➔ Remove var/cache/ini




   ➔php bin/php/ezcache.php --clear-tag=ini
    ➔ Remove var/cache/ini &


      var/cache/active_extensions_{hash}.php

   ➔php bin/php/ezcache.php --clear-id=ini
    ➔ Nothing (bug) : try to recursively delete INI files in


      {varDir}/ini


                                                               11 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   INI CACHE
   How to expire a set of INI files ?
    ➔   Not possible with eZ Scripts

    ➔   Possible & safe using a command line
        ➔ TEST BEFORE : find var/cache/ini -name "site-*"

        ➔ RM : find var/cache/ini -name "site-*" | xargs rm




                                                              12 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   INI CACHE
   How to not compile the INI value ?
   lib/ezutils/classes/ezini.php

   function eZINI( $fileName = 'site.ini', $rootDir = '', $useTextCodec = null,
   $useCache = null, $useLocalOverrides = null, $directAccess = false,
   $addArrayDefinition = false, $load = true )
   {
       ...
   }
    Dynamically load the INI values inside your compiled
                        templates :

   site.ini [eZINISettings] / DynamicTemplateMode=enabled
                                 OR
               Ezini operator → 'dynamic' parameter
                                                                                  13 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   SUMMARY
   CONTEXT
   INI CACHE

   TEMPLATE
   COMPILATION
   VIEWCACHE
   CACHE-BLOCK
   EXPIRY.PHP FILE
   EZCACHE.PHP SCRIPT
   QUESTIONS

                                                     14 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   TPL COMPILATION
   What for ?
     ➔ Compile your .tpl files to .php files
     ➔ Reduce the RAM / CPU (use the stored compiled


       version)

   How to set ? site.ini [templatesettings]
     ➔   TemplateCompile=enabled
         ➔   Store compiled version {varDir}/cache/template/compiled/

     ➔   NodeTreeCaching=enabled ( disabled by default )
         ➔   Store pre-compiled version {varDir}/cache/template/tree/


   Common mistake
     ➔   TemplateCache=enabled → template-block
                                                                        15 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   TPL COMPILATION
   DESIGN                      {varDir}/cache/template/tree   {varDir}/cache/template/compiled

    page_mainarea.tpl           {hash}-page_mainarea.php         page_mainarea-{hash1}.php



                        NodeTreeCaching=enabled
                                                                 page_mainarea-{hash2}.php
                            ( disabled by default )



                                                                 page_mainarea-{hash3}.php




   Why eZ generates several
   compiled files for the same
   .tpl?
                                                                                                 16 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   TPL COMPILATION
   How eZ stores the final compiled files ?

   {VarDir}/cache/template/compiled/, not clusterized

   Filenames : {templatename}-{hash}.php
   page_head-49f4458d0b68aec3cf2de63a6918fd61.php
   page_head-ec3cf2de63a6918fd6149f4458d0b68a.php




                                                        17 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   TPL COMPILATION
   How eZ calculates the hash ?
   $sharedTemplates = false

   {VarDir}/cache/template/compiled/

   Filenames : {templatename}-{hash}.php
   pagelayout-49f4458d0b68aec3cf2de63a6918fd61.php

          Md5( filepath ) / internalCharset / language /
        useFullUrlText / accessText / pageLayoutVariable /
                       indexFile / extraName

                                       /layout/set/...
                                                             18 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   TPL COMPILATION
   How eZ calculate the hash ?
   $sharedTemplates = true

   {VarDir}/cache/template/compiled/

   Filenames : {templatename}-{hash}.php
   pagelayout-aec3cf2de63a6918fd6149f4458d0b68.php

                   Md5( filepath ) / language

               No more siteaccess inside the key...
              Ezini operator → 'dynamic' parameter
                                                      19 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   TPL COMPILATION
   How to pre-compile a set of template
   files (to avoid : on the fly generating) ?
    ➔   Force the compilation of 2 template files
        php bin/php/eztc.php -s mysiteaccess --force
        extension/ezwebin/design/ezwebin/templates/pagelayout.tpl
        extension/ezwebin/design/ezwebin/templates/page_leftmenu.tpl

    ➔   Force the compilation of all template files starting with
        « page_header_ » :
        find extension/ezwebin/ -name "page_header_*.tpl" | xargs php
        bin/php/eztc.php -s mysiteaccess –force

    ➔   Force the compilation of all template files from a TXT file :
        cat template_list.txt | xargs php bin/php/eztc.php -s mysiteaccess
        --force
                                                                         20 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   TPL COMPILATION
   The **** layout module
    ➔   By default ( $shareTemplates = false ), the 'layout' value is used by
        the final compiled filename
    ➔   So if you are using this module with 3 other layouts, you'll produce 4
        compiled files (instead of 1)
    ➔   eztc.php script does not manage the layout parameter

   Your 3 additional compiled files ( for each layout )
   will be procude « on the fly », and cannot be pre-
   compiled with eztc.php
    ➔   Suggestion : improve eztc.php, add the –layout=... parameter



                                                                             21 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   SUMMARY
   CONTEXT
   INI CACHE
   TEMPLATE COMPILATION

   VIEWCACHE
   CACHE-BLOCK
   EXPIRY.PHP FILE
   EZCACHE.PHP SCRIPT
   QUESTIONS




                                                     22 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   VIEWCACHE
                        What for ?
                          ➔   Viewcache = content cache, content
                              viewcache, …

                          ➔   Viewcache is an HTML (or other) cache of
                              the $module_result.content outpout, for a
                              node view call ( content/view/... )



                        ← Illustration : Łukasz Serwatka
                        http://share.ez.no/learn/ez-publish/ez-publish-performance-
                        optimization-part-3-of-3-practical-cache-and-template-solutions/
                        (page)/2




                                                                                 23 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   VIEWCACHE
   How eZ stores the viewcache ?
   {VarDir}/cache/content/{siteaccess}/{number}/{number}/{number}

   {VarDir}/cache/content/{siteaccess}/
   2-ce182234bd70236c6a009578d2a34632.cache
   20-ce182234bd70236c6a009578d2a34632.cache

   {VarDir}/cache/content/{siteaccess}/1
   101-ce182234bd70236c6a009578d2a34632.cache
   105-ce182234bd70236c6a009578d2a34632.cache

   {VarDir}/cache/content/{siteaccess}/5/2/1
   52101-ce182234bd70236c6a009578d2a34632.cache
   52144-ce182234bd70236c6a009578d2a34632.cache


                                                              24 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   VIEWCACHE
   How eZ stores the viewcache ?
   {nodeid}-{hash}.php
   2-ce182234bd70236c6a009578d2a34632.cache
                              md5
  required

   nodeID / viewMode / layout / language (view.p.) / offset
                   (view.p.) / indexFile
  optionnal                         +
   roIeIDList / limitValueList / discountList / cacheNameExtra
         / pr_user / viewParameters / userPreferences
  ViewCacheTweaks[<node_id>]=<setting>[;<setting2>]
  ViewCacheTweaks[global]=<setting>[;<setting2>]

                                                                 25 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   VIEWCACHE
   How to know the exact matching
   between a viewcache file & my URLs ?
   {nodeid}-{hash}.php → deduce the nodeID

   At the end of file :
   "view_parameters";a:6:
   {s:6:"offset";b:0;s:4:"year";b:0;s:5:"month";b:0;s:3:"day";b:0;s:10:"n
   amefilter";b:0;s:4:"test";s:1:"2";}...

   Should be URL : /(test)/2



                                                                     26 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   VIEWCACHE
   How eZ expires a set of viewcache ?
   Alteration of cache states - Depending of the filehandler ( file.ini )

    ➔   Ezfsfilehandler : UNLINK file
    ➔   Ezfs2filehandler : TOUCH file (25/25/1977) ← Star Wars day
    ➔   Ezdbfilehandler : "ezdbfile" (UPDATE expired=1)
    ➔   Ezdfsfilehandler : "ezdfsfile" (UPDATE expired=1)

   Comparison of cache states - Depending of the filehandler ( file.ini )

    ➔   Ezfsfilehandler : file does not exist, or is older than the content-view-
        cache timestamp
    ➔   Ezfs2filehandler : file is older than the content-view-cache timestamp
    ➔   Ezdbfilehandler : "ezdbfile" (expired=1)
    ➔   Ezdfsfilehandler : "ezdfsfile" (expired=1)

                                                                              27 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   VIEWCACHE
   How eZ expires the ENTIRE viewcache ?
       ➔   eZ does not recursively update / delete the files (too many files...
           unsafe)

      eZ set a global timestamp expiry value :
       ➔


    {VarDir}/cache/expiry.php ← 'content-view-cache' ( current timestamp)


   Each time the expiry.php is updated, the ENTIRE viewcache
   will expire.
   ➔ Ok, but my ENTIRE viewcache expires all the
   time... i did nothing special ! Don't know why !

                                                                                  28 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   VIEWCACHE
   Which event / trigger expires a set of
   cache ?
   By default : on object publication (or back-end feature)
    ➔ the related nodes & parent node




   Willingly, using a script :
    ➔ bin/php/ezcontentcache.php –clear-node=2

    ➔ bin/php/ezcontentcache.php –clear-node=2,46,63

    ➔ bin/php/ezcontentcache.php –clear-node=/company/about

    ➔ bin/php/ezcontentcache.php –clear-subtree=/company/about

    ➔ bin/php/ezcontentcache.php –clear-


       subtree=/company/about,/news




                                                                 29 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   VIEWCACHE
   Smart viewcache & cacheThreshold : a
   set of cache → the ENTIRE view cache
   Automatically, if using the smart view cache / viewcache.ini :

    ➔   The smart view cache populates a list of related « node_id »
        viewcache files to expire, depending of your settings. If this node_id list
        is larger than the CacheThreshold limit value (250 by default) → eZ
        expires the ENTIRE viewcache !

    ➔   Some settings could increase the node_id list count & excede the
        CacheThreshold limit : ALL, siblings, KeywordNodesCacheClearLimit

    ➔   Advice : Set KeywordNodesCacheClearLimit = 0, never use ALL, avoid
        siblings, log out the CacheThreshold (ezpEvent)

                                                                              30 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   VIEWCACHE
   Log the viewcache node_id list to expire,
   prevent the CacheThreshold limit...
    ➔   Add an ezpEvent : site.ini.append.php

   [Event]
   Listeners[]=content/cache@test::logviewcache

   # test = your PHP class name
   # logviewcache = the static method




                                                     31 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   VIEWCACHE
   Log the viewcache node_id list to expire,
   prevent the CacheThreshold limit...
      ➔   Create a PHP class / generate autoloads

   <?php
   class test
   {
      static public function logviewcache( $nodeList )
     {
                $uri = $GLOBALS['_SERVER']['REQUEST_URI'];
                eZLog::write('node_id count : '. count( $nodeList ). ' / node_id list : ' . implode(', ', $nodeList ) . ' / URI : '.$uri,
   'chachethresold.log');

                return $nodeList;
     }}
   ?>


      ➔   Log output :
          [ Feb 06 2012 17:48:34 ] node_id count : 5 / node_id list : 1 105, 2, 1, 78
                                                                       16,
          / URI : /content/edit/114/2/fre-FR
                                                                                                                                        32 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   VIEWCACHE
   My ENTIRE viewcache still expire...
   Maybe you invoked one of these features (back-end, API)  :

    ➔   Create a new content class ( BUG ? )
    ➔   Update / delete an existing content class ( or attributes )
    ➔   Update / delete and existing role ( & policies ) OR role assignement
    ➔   Section assignement
    ➔   Update an ezshop rule ( discount rules, currency... )




                                                                           33 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS




                                                     34 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS




                                                     35 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   SUMMARY
   CONTEXT
   INI CACHE
   TEMPLATE COMPILATION
   VIEWCACHE

   CACHE-BLOCK
   EXPIRY.PHP FILE
   EZCACHE.PHP SCRIPT
   QUESTIONS




                                                     36 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   CACHE-BLOCK
   ...                  What for ?
                          ➔   Template-block cache = cache files
                              related to cache-block, also called
                              « template cache » ( common mistake with
                              the template compilation )

                          ➔   Template-block cache is an HTML (or
                              other) cache of a template part ( cache-
                              block )



                        ← Illustration : Łukasz Serwatka
                        http://share.ez.no/learn/ez-publish/ez-publish-performance-
                        optimization-part-3-of-3-practical-cache-and-template-solutions/
                        (page)/2

                                                                                 37 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   CACHE-BLOCK
   Impact of common parameters
   The « keys » parameter :

   Please AVOID :
   {cache-block keys=$uri_string}   1 template-block file
   ...                              for each URI !!!
   {/cache-block}

   Use instead :
   {cache-block keys=$my_custom_limited_range_key}
   ...
   {/cache-block}
                      Only possible states of your content
                      inside your block
                                                             38 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   CACHE-BLOCK
   Impact of common parameters
   The « URI key » parameter : stupid but signifiant simulation

    ➔   A classic Web site, with 1000 nodes, news folder ( year, month
        archives ), products catalog ( filters ), calendar, forum...
    ➔   Could generate 10 000 « indexable » several URI ( google bot )
    ➔   A cache-block ( only 1 URI key ) to cache the global menu, who is
        generating 300 SQL queries
    ➔   No « expiry » or « ignore_content_expiry » parameters : so the cache-
        block expires every 2 hours (or on content publication)

    ➔   So... 300 SQL queries * 12 expiration per day * 10 000 URI = 36 millions of
        SQL queries per day...



                                                                               39 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   CACHE-BLOCK
   Impact of common parameters
   The « expiry » parameter :

   If possible, always set a custom expiry value & ignore content
   expiry :
   {cache-block ignore_content_expiry expiry=86400}
   ...
   {/cache-block}




                                                             40 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   CACHE-BLOCK
   Impact of common parameters
   The « sutree_expiry » parameter : no more expiry /
   ignore_content_expiry needed

   {cache-block subtree_expiry='news/'}
   ...
   {/cache-block}


   {cache-block subtree_expiry=142}
   ...
   {/cache-block}


                                                        41 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   CACHE-BLOCK
   Impact of common parameters
   The « sutree_expiry » parameter : tip of the « magic » node

    ➔   To expire a cache-block, depending of a custom rule ( per content
        class, per PHP algorithm ... )

    ➔   Create a {cache-block subtree_expiry=$magic_node_id}

    ➔   Create a node somewhere ( safe location, without FULL view )

    ➔   Create a workflow or customedithandler to include your custom rules
        on publication, and update the content object related to the magic
        node by the code



                                                                        42 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   CACHE-BLOCK
   Cache-block imbrication
   {cache-block expiry=3600}
   ...
       {cache-block ignore_content_expiry expiry=86400}

            ... {* you save … SQL Queries each hours *}

         {/cache-block}
   ...
         {cache-block subtree_expiry='news/'}
            ...
         {/cache-block}
   ...
   {/cache-block}


                                                          43 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   CACHE-BLOCK
   I need a « real time » block ( TTL=1m )
   A cache-block may not be the solution, use instead :

    ➔   ESI ( Edge Side Include ) : better for front-end loading &
        google bot indexing. But reverse-proxy required ( varnish,
        squid, akamai... )

    ➔   AJAX : easier to implement




                                                                44 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   CACHE-BLOCK
   How eZ stores the template-block cache
   {VarDir}/cache/template-block/1/2/3/12345678.cache

   {VarDir}/cache/template-block/5/5/5/555666888.cache

   {VarDir}/cache/template-block/subtree/1/5/9/cache/1/2/3/12345678.cache


                       subtree_expiry=159                CRC32
                                                      Complex... The
                                                  pathname doesn't help




                                                                            45 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   CACHE-BLOCK
   How eZ stores the template-block cache
   {VarDir}/cache/template-block/1/2/3/12345678.cache

                                                 CRC32 ( 32-bit polynomial checksum )



      Cache-block position in the .tpl file / template path /
                      keys / siteaccess


         78_1_78_94_extension/ezwebin/design/ezwebin/templates/pagelayout.tpl

         78 = {cache-block... } line start
         1 = {cache-block... } column start (a simple ' ' before...)
         78 = {cache-block... } line end
         94 = {cache-block... } column end
                                                                                        46 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   CACHE-BLOCK
   How to expire the ALL of the template-
   block cache files ?
   php bin/php/ezcache.php –clear-id=template-block

    ➔   Expires all the template-block files, by updating the global
        cache-block expiry time ( global-template-block-cache )
        in the {varDir}/expiry.php file




                                                                47 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   CACHE-BLOCK
   How to expire a set of specific template-
   block cache files ?
    ➔   Not really possible... exept by searching a specific string
        inside each files, and deleting matching files ( ezfs /
        ezFS2 )

    ➔   find var/myvardir/cache/template-block/ -mmin -10 -name "*.cache"
        -exec grep -iHl "ID:BLOCK1" {} ; | xargs rm

        {cache-block ignore_content_expiry expiry=0}
           <!-- ID:BLOCK1 -->
           ...
        {/cache-block}

                                                                     48 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   CACHE-BLOCK
   PULL REQUEST IDEA :
      {cache-block id=myfolder ignore_content_expiry expiry=0}
      <!-- ID:BLOCK1 -->
         ...
      {/cache-block}


      {VarDir}/cache/template-block/myfolder/1/2/3/12345678.cache

   So... to expire your cache-block :
   mv myfolder myfolder-to-remove
   nice -n 20 rm -r myfolder-to-remove
                                                                    49 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   SUMMARY
   CONTEXT
   INI CACHE
   TEMPLATE COMPILATION
   VIEWCACHE
   CACHE-BLOCK

   EXPIRY.PHP FILE
   EZCACHE.PHP SCRIPT
   QUESTIONS




                                                     50 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   EXPIRY.PHP FILE
   <?php                                          What for ?
   $Timestamps = array (
     'state-limitations' => 1321010927,
     'user-info-cache' => 1323788789,                ➔   To globally expire a cache, eZ
     'content-view-cache' => 1326299075,                 Publish update the related value
     'class-identifier-cache' => 1326298969,
     'global-template-block-cache' => 1325856140,
                                                         with the current timestamp.
     'content-tree-menu' => 1326298969,
     'image-manager-alias' => 1323788788,            ➔   eZ Publish compares « on the fly »
     'active-extensions-cache' => 1325668728,
                                                         this updated value with each
     'ts-translation-cache' => 1323788789,
     'content-complex-viewmode-cache' => 1325780763,     caches mtime, always older
     'template-block-cache' => 1326298969,
     'user-class-cache' => 1326298969,
     'sort-key-cache' => 1326298969,
   );




                                                                                        51 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   SUMMARY
   CONTEXT
   INI CACHE
   TEMPLATE COMPILATION
   VIEWCACHE
   CACHE-BLOCK
   EXPIRY.PHP FILE

   EZCACHE.PHP
   SCRIPT
   CONCLUSION

                                                     52 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   EZCACHE.PHP SCRIPT
   FAMOUS EZSCRIPT
   php bin/php/ezcache.php --clear-id=[ID]
   php bin/php/ezcache.php --clear-id=[ID] --purge
   php bin/php/ezcache.php --clear-tag=[TAG]
   php bin/php/ezcache.php --clear-tag=[TAG] --purge
   php bin/php/ezcache.php --clear-all
   php bin/php/ezcache.php --clear-all --purge

   NEED SOME HELP                        Does it do something
   php bin/php/ezcache.php --help              special ?
                                            Superstitious
   php bin/php/ezcache.php --list-ids
                                             parameter
   php bin/php/ezcache.php --list-tags
                                                           53 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   EZCACHE.PHP SCRIPT
   TAG                ID
   content            content / classid / sortey / urlalias / rss_cache /
                      content_tree_menu / state_limiations / template-
                      block / ezjscore-packer

   template           template / template-block / template-override /
                      texttoimage / design_base / ezjscore-packer

   ini                ini / global_ini / active_extensions

   user               user_info_cache
   I18n               translation / chartrans
   codepage           codepage
   image              imagealias
   rest               rest / rest-routes


                                                                            54 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   EZCACHE.PHP SCRIPT
   MAIN ALGORITHM
   Hardcoded in kernel/classes/ezcache.php.
   For each ID :

   'id' => ID
   'tag' => array( TAG LIST )
   'enabled' => Cache enabled or not
   'is-clustered' => Use the current filehandler or not ?
   'path' => Path to purge, if purging (is-clustered=false)
   'expiry-key' => Key to set inside the expiry.php file if needed
   'function' => Function to apply only on clearing (not purging)
   'function-purge' => Function to apply only on purging (not
   clearing)
                                                               55 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   EZCACHE.PHP SCRIPT
   MAIN ALGORITHM
   Add your own ID for your extensions ( site.ini.append.php )

   # Cache item entry (for eZ Publish 4.3 and up)
   [Cache]
   CacheItems[]=ezjscore

   [Cache_ezjscore]
   name=eZJSCore Public Packer cache
   id=ezjscore-packer
   tags[]=content
   tags[]=template
   path=public
   isClustered=true

                                                             56 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   EZCACHE.PHP SCRIPT
   A BUG HELPS TO UNDERSTAND
   php bin/php/ezcache.php --clear-id=ini

   array( 'name' => ezpI18n::tr( 'kernel/cache', 'INI cache' ),
           'id' => 'ini',
           'tag' => array( 'ini' ),
           'enabled' => true,
           'path' => 'ini' ),

   Why is it not working ?



                                                                  57 / 58
:~$ eZ Publish Caching Mechanisms // SPICY DETAILS


   SUMMARY
   CONTEXT
   INI CACHE
   TEMPLATE COMPILATION
   VIEWCACHE
   CACHE-BLOCK
   EXPIRY.PHP FILE
   EZCACHE.PHP SCRIPT

   QUESTIONS

                                                     58 / 58

Más contenido relacionado

La actualidad más candente

OpenStackで始めるクラウド環境構築入門 Havana&DevStack編
OpenStackで始めるクラウド環境構築入門 Havana&DevStack編OpenStackで始めるクラウド環境構築入門 Havana&DevStack編
OpenStackで始めるクラウド環境構築入門 Havana&DevStack編VirtualTech Japan Inc.
 
忙しい人の5分で分かるMesos入門 - Mesos って何だ?
忙しい人の5分で分かるMesos入門 - Mesos って何だ?忙しい人の5分で分かるMesos入門 - Mesos って何だ?
忙しい人の5分で分かるMesos入門 - Mesos って何だ?Masahito Zembutsu
 
Windows PowerShell によるWindows Server 管理の自動化 v4.0 2014.03.13 更新版
Windows PowerShell によるWindows Server 管理の自動化 v4.0 2014.03.13 更新版Windows PowerShell によるWindows Server 管理の自動化 v4.0 2014.03.13 更新版
Windows PowerShell によるWindows Server 管理の自動化 v4.0 2014.03.13 更新版junichi anno
 
Swagger ではない OpenAPI Specification 3.0 による API サーバー開発
Swagger ではない OpenAPI Specification 3.0 による API サーバー開発Swagger ではない OpenAPI Specification 3.0 による API サーバー開発
Swagger ではない OpenAPI Specification 3.0 による API サーバー開発Yahoo!デベロッパーネットワーク
 
DCSF19 Hardening Docker daemon with Rootless mode
DCSF19 Hardening Docker daemon with Rootless modeDCSF19 Hardening Docker daemon with Rootless mode
DCSF19 Hardening Docker daemon with Rootless modeDocker, Inc.
 
10 x 30 Frame Tent Installation Instructions
10 x 30 Frame Tent Installation Instructions 10 x 30 Frame Tent Installation Instructions
10 x 30 Frame Tent Installation Instructions celinatent
 
軽い! 速い! サーバを選ばない! Ruby製CMS "nanoc"
軽い! 速い! サーバを選ばない! Ruby製CMS "nanoc"軽い! 速い! サーバを選ばない! Ruby製CMS "nanoc"
軽い! 速い! サーバを選ばない! Ruby製CMS "nanoc"Go Maeda
 
IoT向けプラットフォーム「SORACOM」とは? 他2本
IoT向けプラットフォーム「SORACOM」とは? 他2本IoT向けプラットフォーム「SORACOM」とは? 他2本
IoT向けプラットフォーム「SORACOM」とは? 他2本SORACOM,INC
 
How to contribute to open source
How to contribute to open sourceHow to contribute to open source
How to contribute to open sourceAlbert Wong
 
Kubernetes Meetup Tokyo #35_GitOps Toolkit による Kubernetes マニフェスト CD
Kubernetes Meetup Tokyo #35_GitOps Toolkit による Kubernetes マニフェスト CDKubernetes Meetup Tokyo #35_GitOps Toolkit による Kubernetes マニフェスト CD
Kubernetes Meetup Tokyo #35_GitOps Toolkit による Kubernetes マニフェスト CDPreferred Networks
 
Scalaのコンパイルを3倍速くした話
Scalaのコンパイルを3倍速くした話Scalaのコンパイルを3倍速くした話
Scalaのコンパイルを3倍速くした話tod esking
 
AngularとSpring Bootで作るSPA + RESTful Web Serviceアプリケーション
AngularとSpring Bootで作るSPA + RESTful Web ServiceアプリケーションAngularとSpring Bootで作るSPA + RESTful Web Serviceアプリケーション
AngularとSpring Bootで作るSPA + RESTful Web Serviceアプリケーションssuser070fa9
 
Present でスライドを作ろう
Present でスライドを作ろうPresent でスライドを作ろう
Present でスライドを作ろうYutaka Kato
 
Webアプリケーション上で 起きている問題の可視化
Webアプリケーション上で 起きている問題の可視化Webアプリケーション上で 起きている問題の可視化
Webアプリケーション上で 起きている問題の可視化LINE Corporation
 
Fess/Elasticsearchを使った業務で使える?全文検索への道
Fess/Elasticsearchを使った業務で使える?全文検索への道Fess/Elasticsearchを使った業務で使える?全文検索への道
Fess/Elasticsearchを使った業務で使える?全文検索への道Shinsuke Sugaya
 
日本語テストメソッドについて
日本語テストメソッドについて日本語テストメソッドについて
日本語テストメソッドについてkumake
 

La actualidad más candente (20)

OpenStackで始めるクラウド環境構築入門 Havana&DevStack編
OpenStackで始めるクラウド環境構築入門 Havana&DevStack編OpenStackで始めるクラウド環境構築入門 Havana&DevStack編
OpenStackで始めるクラウド環境構築入門 Havana&DevStack編
 
忙しい人の5分で分かるMesos入門 - Mesos って何だ?
忙しい人の5分で分かるMesos入門 - Mesos って何だ?忙しい人の5分で分かるMesos入門 - Mesos って何だ?
忙しい人の5分で分かるMesos入門 - Mesos って何だ?
 
Windows PowerShell によるWindows Server 管理の自動化 v4.0 2014.03.13 更新版
Windows PowerShell によるWindows Server 管理の自動化 v4.0 2014.03.13 更新版Windows PowerShell によるWindows Server 管理の自動化 v4.0 2014.03.13 更新版
Windows PowerShell によるWindows Server 管理の自動化 v4.0 2014.03.13 更新版
 
Swagger ではない OpenAPI Specification 3.0 による API サーバー開発
Swagger ではない OpenAPI Specification 3.0 による API サーバー開発Swagger ではない OpenAPI Specification 3.0 による API サーバー開発
Swagger ではない OpenAPI Specification 3.0 による API サーバー開発
 
DCSF19 Hardening Docker daemon with Rootless mode
DCSF19 Hardening Docker daemon with Rootless modeDCSF19 Hardening Docker daemon with Rootless mode
DCSF19 Hardening Docker daemon with Rootless mode
 
10 x 30 Frame Tent Installation Instructions
10 x 30 Frame Tent Installation Instructions 10 x 30 Frame Tent Installation Instructions
10 x 30 Frame Tent Installation Instructions
 
軽い! 速い! サーバを選ばない! Ruby製CMS "nanoc"
軽い! 速い! サーバを選ばない! Ruby製CMS "nanoc"軽い! 速い! サーバを選ばない! Ruby製CMS "nanoc"
軽い! 速い! サーバを選ばない! Ruby製CMS "nanoc"
 
IoT向けプラットフォーム「SORACOM」とは? 他2本
IoT向けプラットフォーム「SORACOM」とは? 他2本IoT向けプラットフォーム「SORACOM」とは? 他2本
IoT向けプラットフォーム「SORACOM」とは? 他2本
 
How to contribute to open source
How to contribute to open sourceHow to contribute to open source
How to contribute to open source
 
Kubernetes Meetup Tokyo #35_GitOps Toolkit による Kubernetes マニフェスト CD
Kubernetes Meetup Tokyo #35_GitOps Toolkit による Kubernetes マニフェスト CDKubernetes Meetup Tokyo #35_GitOps Toolkit による Kubernetes マニフェスト CD
Kubernetes Meetup Tokyo #35_GitOps Toolkit による Kubernetes マニフェスト CD
 
Apache Solr 検索エンジン入門
Apache Solr 検索エンジン入門Apache Solr 検索エンジン入門
Apache Solr 検索エンジン入門
 
Scalaのコンパイルを3倍速くした話
Scalaのコンパイルを3倍速くした話Scalaのコンパイルを3倍速くした話
Scalaのコンパイルを3倍速くした話
 
KubeConRecap_nakamura.pdf
KubeConRecap_nakamura.pdfKubeConRecap_nakamura.pdf
KubeConRecap_nakamura.pdf
 
AngularとSpring Bootで作るSPA + RESTful Web Serviceアプリケーション
AngularとSpring Bootで作るSPA + RESTful Web ServiceアプリケーションAngularとSpring Bootで作るSPA + RESTful Web Serviceアプリケーション
AngularとSpring Bootで作るSPA + RESTful Web Serviceアプリケーション
 
Present でスライドを作ろう
Present でスライドを作ろうPresent でスライドを作ろう
Present でスライドを作ろう
 
Webアプリケーション上で 起きている問題の可視化
Webアプリケーション上で 起きている問題の可視化Webアプリケーション上で 起きている問題の可視化
Webアプリケーション上で 起きている問題の可視化
 
Fess/Elasticsearchを使った業務で使える?全文検索への道
Fess/Elasticsearchを使った業務で使える?全文検索への道Fess/Elasticsearchを使った業務で使える?全文検索への道
Fess/Elasticsearchを使った業務で使える?全文検索への道
 
Hacktoberfest 2022
Hacktoberfest 2022Hacktoberfest 2022
Hacktoberfest 2022
 
日本語テストメソッドについて
日本語テストメソッドについて日本語テストメソッドについて
日本語テストメソッドについて
 
Contributing to Open Source - A Beginners Guide
Contributing to Open Source - A Beginners GuideContributing to Open Source - A Beginners Guide
Contributing to Open Source - A Beginners Guide
 

Similar a eZ Publish Caching Mechanisms

Workshop eZ Publish Caching Mechanisms
Workshop eZ Publish Caching MechanismsWorkshop eZ Publish Caching Mechanisms
Workshop eZ Publish Caching MechanismsKaliop-slide
 
Zend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applicationsZend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applicationsEnrico Zimuel
 
Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011Wim Godden
 
phptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorialphptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorialWim Godden
 
Caching with Memcached and APC
Caching with Memcached and APCCaching with Memcached and APC
Caching with Memcached and APCBen Ramsey
 
PHP & Performance
PHP & PerformancePHP & Performance
PHP & Performance毅 吕
 
Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011Wim Godden
 
eZ Publish Cluster Unleashed
eZ Publish Cluster UnleashedeZ Publish Cluster Unleashed
eZ Publish Cluster UnleashedBertrand Dunogier
 
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
 
Dutch php conference_apc_mem2010
Dutch php conference_apc_mem2010Dutch php conference_apc_mem2010
Dutch php conference_apc_mem2010isnull
 
eZ Publish cluster unleashed revisited
eZ Publish cluster unleashed revisitedeZ Publish cluster unleashed revisited
eZ Publish cluster unleashed revisitedBertrand Dunogier
 
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiGrâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiJérémy Derussé
 
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
 
Adventures in infrastructure as code
Adventures in infrastructure as codeAdventures in infrastructure as code
Adventures in infrastructure as codeJulian Simpson
 
PECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life betterPECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life betterZendCon
 
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
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Michele Orselli
 
php & performance
 php & performance php & performance
php & performancesimon8410
 
Site Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariSite Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariJoseph Scott
 

Similar a eZ Publish Caching Mechanisms (20)

Workshop eZ Publish Caching Mechanisms
Workshop eZ Publish Caching MechanismsWorkshop eZ Publish Caching Mechanisms
Workshop eZ Publish Caching Mechanisms
 
Zend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applicationsZend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applications
 
Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011Caching and tuning fun for high scalability @ phpBenelux 2011
Caching and tuning fun for high scalability @ phpBenelux 2011
 
phptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorialphptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorial
 
Caching with Memcached and APC
Caching with Memcached and APCCaching with Memcached and APC
Caching with Memcached and APC
 
PHP & Performance
PHP & PerformancePHP & Performance
PHP & Performance
 
Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011
 
eZ Publish Cluster Unleashed
eZ Publish Cluster UnleashedeZ Publish Cluster Unleashed
eZ Publish Cluster Unleashed
 
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
 
Dutch php conference_apc_mem2010
Dutch php conference_apc_mem2010Dutch php conference_apc_mem2010
Dutch php conference_apc_mem2010
 
eZ Publish cluster unleashed revisited
eZ Publish cluster unleashed revisitedeZ Publish cluster unleashed revisited
eZ Publish cluster unleashed revisited
 
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiGrâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
 
Pecl Picks
Pecl PicksPecl Picks
Pecl Picks
 
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
 
Adventures in infrastructure as code
Adventures in infrastructure as codeAdventures in infrastructure as code
Adventures in infrastructure as code
 
PECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life betterPECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life better
 
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
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))
 
php & performance
 php & performance php & performance
php & performance
 
Site Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariSite Performance - From Pinto to Ferrari
Site Performance - From Pinto to Ferrari
 

Más de Kaliop-slide

E z conference 2016 : The Next Generation of Innovative Applications: Powere...
E z conference 2016  : The Next Generation of Innovative Applications: Powere...E z conference 2016  : The Next Generation of Innovative Applications: Powere...
E z conference 2016 : The Next Generation of Innovative Applications: Powere...Kaliop-slide
 
L'agilité au service de l'innovation
L'agilité au service de l'innovationL'agilité au service de l'innovation
L'agilité au service de l'innovationKaliop-slide
 
[webinar du 26/02/2015] Magento / Prestashop : bien choisir sa solution e-com...
[webinar du 26/02/2015] Magento / Prestashop : bien choisir sa solution e-com...[webinar du 26/02/2015] Magento / Prestashop : bien choisir sa solution e-com...
[webinar du 26/02/2015] Magento / Prestashop : bien choisir sa solution e-com...Kaliop-slide
 
[Webinar du 6/11/2014] Réussir son projet E-commerce en mode agile
[Webinar du 6/11/2014] Réussir son projet E-commerce en mode agile[Webinar du 6/11/2014] Réussir son projet E-commerce en mode agile
[Webinar du 6/11/2014] Réussir son projet E-commerce en mode agileKaliop-slide
 
[Webinar du 17/06/2014] Bien intégrer sa boutique e-Commerce à son système d'...
[Webinar du 17/06/2014] Bien intégrer sa boutique e-Commerce à son système d'...[Webinar du 17/06/2014] Bien intégrer sa boutique e-Commerce à son système d'...
[Webinar du 17/06/2014] Bien intégrer sa boutique e-Commerce à son système d'...Kaliop-slide
 
Web performances : Is It not the right time to (re)consider CMS ?
Web performances : Is It not the right time to (re)consider CMS ?Web performances : Is It not the right time to (re)consider CMS ?
Web performances : Is It not the right time to (re)consider CMS ?Kaliop-slide
 
L’amélioration continue de votre environnement de travail et de votre entrepr...
L’amélioration continue de votre environnement de travail et de votre entrepr...L’amélioration continue de votre environnement de travail et de votre entrepr...
L’amélioration continue de votre environnement de travail et de votre entrepr...Kaliop-slide
 
Ezobject wrapper workshop
Ezobject wrapper workshopEzobject wrapper workshop
Ezobject wrapper workshopKaliop-slide
 
Comment créer, optimiser et monétiser vos contenus ?
Comment créer, optimiser et monétiser vos contenus ?Comment créer, optimiser et monétiser vos contenus ?
Comment créer, optimiser et monétiser vos contenus ?Kaliop-slide
 
Web performance optimization
Web performance optimizationWeb performance optimization
Web performance optimizationKaliop-slide
 
How to deploy & optimize eZ Publish (2014)
How to deploy & optimize eZ Publish (2014)How to deploy & optimize eZ Publish (2014)
How to deploy & optimize eZ Publish (2014)Kaliop-slide
 
eZ Publish vs Drupal - technical battle
eZ Publish vs Drupal - technical battleeZ Publish vs Drupal - technical battle
eZ Publish vs Drupal - technical battleKaliop-slide
 
Utilisation d’eZ Flow sur le site www.kaliop.fr
Utilisation d’eZ Flow sur le site www.kaliop.frUtilisation d’eZ Flow sur le site www.kaliop.fr
Utilisation d’eZ Flow sur le site www.kaliop.frKaliop-slide
 
Demystifying eZ Publish 5.x for eZ Publish 4.0 developers
Demystifying eZ Publish 5.x for eZ Publish 4.0 developersDemystifying eZ Publish 5.x for eZ Publish 4.0 developers
Demystifying eZ Publish 5.x for eZ Publish 4.0 developersKaliop-slide
 
Webinar e-tourisme : Créer une expérience utilisateur riche grâce à eZ Publish
Webinar e-tourisme : Créer une expérience utilisateur riche grâce à eZ PublishWebinar e-tourisme : Créer une expérience utilisateur riche grâce à eZ Publish
Webinar e-tourisme : Créer une expérience utilisateur riche grâce à eZ PublishKaliop-slide
 
Bien choisir sa solution e-commerce
Bien choisir sa solution e-commerceBien choisir sa solution e-commerce
Bien choisir sa solution e-commerceKaliop-slide
 
Webinar : ezpublish pour vos projets e-tourisme
Webinar : ezpublish pour vos projets e-tourismeWebinar : ezpublish pour vos projets e-tourisme
Webinar : ezpublish pour vos projets e-tourismeKaliop-slide
 
How to deploy & optimize eZ Publish
How to deploy & optimize eZ PublishHow to deploy & optimize eZ Publish
How to deploy & optimize eZ PublishKaliop-slide
 
Optimisez vos flux commerciaux avec la marketing automation
Optimisez vos flux commerciaux avec la marketing automationOptimisez vos flux commerciaux avec la marketing automation
Optimisez vos flux commerciaux avec la marketing automationKaliop-slide
 
Tour de Contrôle (Kaliop E-Commerce Dataflow System)
Tour de Contrôle (Kaliop E-Commerce Dataflow System)Tour de Contrôle (Kaliop E-Commerce Dataflow System)
Tour de Contrôle (Kaliop E-Commerce Dataflow System)Kaliop-slide
 

Más de Kaliop-slide (20)

E z conference 2016 : The Next Generation of Innovative Applications: Powere...
E z conference 2016  : The Next Generation of Innovative Applications: Powere...E z conference 2016  : The Next Generation of Innovative Applications: Powere...
E z conference 2016 : The Next Generation of Innovative Applications: Powere...
 
L'agilité au service de l'innovation
L'agilité au service de l'innovationL'agilité au service de l'innovation
L'agilité au service de l'innovation
 
[webinar du 26/02/2015] Magento / Prestashop : bien choisir sa solution e-com...
[webinar du 26/02/2015] Magento / Prestashop : bien choisir sa solution e-com...[webinar du 26/02/2015] Magento / Prestashop : bien choisir sa solution e-com...
[webinar du 26/02/2015] Magento / Prestashop : bien choisir sa solution e-com...
 
[Webinar du 6/11/2014] Réussir son projet E-commerce en mode agile
[Webinar du 6/11/2014] Réussir son projet E-commerce en mode agile[Webinar du 6/11/2014] Réussir son projet E-commerce en mode agile
[Webinar du 6/11/2014] Réussir son projet E-commerce en mode agile
 
[Webinar du 17/06/2014] Bien intégrer sa boutique e-Commerce à son système d'...
[Webinar du 17/06/2014] Bien intégrer sa boutique e-Commerce à son système d'...[Webinar du 17/06/2014] Bien intégrer sa boutique e-Commerce à son système d'...
[Webinar du 17/06/2014] Bien intégrer sa boutique e-Commerce à son système d'...
 
Web performances : Is It not the right time to (re)consider CMS ?
Web performances : Is It not the right time to (re)consider CMS ?Web performances : Is It not the right time to (re)consider CMS ?
Web performances : Is It not the right time to (re)consider CMS ?
 
L’amélioration continue de votre environnement de travail et de votre entrepr...
L’amélioration continue de votre environnement de travail et de votre entrepr...L’amélioration continue de votre environnement de travail et de votre entrepr...
L’amélioration continue de votre environnement de travail et de votre entrepr...
 
Ezobject wrapper workshop
Ezobject wrapper workshopEzobject wrapper workshop
Ezobject wrapper workshop
 
Comment créer, optimiser et monétiser vos contenus ?
Comment créer, optimiser et monétiser vos contenus ?Comment créer, optimiser et monétiser vos contenus ?
Comment créer, optimiser et monétiser vos contenus ?
 
Web performance optimization
Web performance optimizationWeb performance optimization
Web performance optimization
 
How to deploy & optimize eZ Publish (2014)
How to deploy & optimize eZ Publish (2014)How to deploy & optimize eZ Publish (2014)
How to deploy & optimize eZ Publish (2014)
 
eZ Publish vs Drupal - technical battle
eZ Publish vs Drupal - technical battleeZ Publish vs Drupal - technical battle
eZ Publish vs Drupal - technical battle
 
Utilisation d’eZ Flow sur le site www.kaliop.fr
Utilisation d’eZ Flow sur le site www.kaliop.frUtilisation d’eZ Flow sur le site www.kaliop.fr
Utilisation d’eZ Flow sur le site www.kaliop.fr
 
Demystifying eZ Publish 5.x for eZ Publish 4.0 developers
Demystifying eZ Publish 5.x for eZ Publish 4.0 developersDemystifying eZ Publish 5.x for eZ Publish 4.0 developers
Demystifying eZ Publish 5.x for eZ Publish 4.0 developers
 
Webinar e-tourisme : Créer une expérience utilisateur riche grâce à eZ Publish
Webinar e-tourisme : Créer une expérience utilisateur riche grâce à eZ PublishWebinar e-tourisme : Créer une expérience utilisateur riche grâce à eZ Publish
Webinar e-tourisme : Créer une expérience utilisateur riche grâce à eZ Publish
 
Bien choisir sa solution e-commerce
Bien choisir sa solution e-commerceBien choisir sa solution e-commerce
Bien choisir sa solution e-commerce
 
Webinar : ezpublish pour vos projets e-tourisme
Webinar : ezpublish pour vos projets e-tourismeWebinar : ezpublish pour vos projets e-tourisme
Webinar : ezpublish pour vos projets e-tourisme
 
How to deploy & optimize eZ Publish
How to deploy & optimize eZ PublishHow to deploy & optimize eZ Publish
How to deploy & optimize eZ Publish
 
Optimisez vos flux commerciaux avec la marketing automation
Optimisez vos flux commerciaux avec la marketing automationOptimisez vos flux commerciaux avec la marketing automation
Optimisez vos flux commerciaux avec la marketing automation
 
Tour de Contrôle (Kaliop E-Commerce Dataflow System)
Tour de Contrôle (Kaliop E-Commerce Dataflow System)Tour de Contrôle (Kaliop E-Commerce Dataflow System)
Tour de Contrôle (Kaliop E-Commerce Dataflow System)
 

Último

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 

Último (20)

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 

eZ Publish Caching Mechanisms

  • 1. eZ Partner Conference in Lisbon. Feb 9th eZ Publish Caching Mechanisms // SPICY DETAILS Gilles Guirand CTO Kaliop / platinum partner eZ Publish board member @gandbox
  • 2. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS SUMMARY CONTEXT INI CACHE TEMPLATE COMPILATION VIEWCACHE CACHE-BLOCK EXPIRY.PHP FILE EZCACHE.PHP SCRIPT QUESTIONS 2 / 58
  • 3. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS SUMMARY CONTEXT INI CACHE TEMPLATE COMPILATION VIEWCACHE CACHE-BLOCK EXPIRY.PHP FILE EZCACHE.PHP SCRIPT QUESTIONS 3 / 58
  • 4. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS CONTEXT Common questions ( high trafic ) : ➔Is it possible to never expire the ENTIRE viewcache ? … and which actions actually expire the ENTIRE viewcache ? ➔ Is it possible to reduce the I/O (template-blocks) ? ➔ Is it possible to expire a specific set of viewcache ? ➔ Is it possible to expire a specific set ot template-block files ? ➔ Is there a best practice to PUSH a daily templates update ? 4 / 58
  • 5. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS CONTEXT Final questions : ➔ How all these cache mechanisms really work ? … I mean in details... algorithms, I/O, triggers, exceptions, undocumented features & settings, unknown bugs, unknown fixes... Final solutions : ➔ Don't trust the documentation : READ THE KERNEL / TEST THE KERNEL... ( be brave ) 5 / 58
  • 6. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS CONTEXT Knowledge exploitation / reuse : ➔ Write a FR document (46 pages) : mix between a documentation & tuto ➔ Publish it on differents supports (FR + EN) ➔ Split the article into 4 parts : 1 2 3 4 INI VIEWCACHE Template- expiry.php Tpl compilation block ezcache.php bench 6 / 58
  • 7. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS CONTEXT Publication schedule : FEB MARCH APRIL MAY JUNE 1 2 3 4 FR 1 2 3 4 gandbox.fr FR share.ez.no EN 1 2 3 4 ➔ (depending of translation delay) 7 / 58
  • 8. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS SUMMARY CONTEXT INI CACHE TEMPLATE COMPILATION VIEWCACHE CACHE-BLOCK EXPIRY.PHP FILE EZCACHE.PHP SCRIPT QUESTIONS 8 / 58
  • 9. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS INI CACHE When eZ generates the INI cache ? ➔ On the fly (if the cache file does not exist) – from an API call (ezini PHP class), a template call (ezini operator) ➔ By default, eZ automatically check if an INI file has been changed or not, depending of this setting (config.php) //define( 'EZP_INI_FILEMTIME_CHECK', false ) ; /* Set EZP_INI_FILEMTIME_CHECK constant to false to improve performance ( 10% ~ 15% on I/O ) by not checking modified time on ini files. You can also set it to a string, the name of a ini file you still want to check modified time on, best example would be to set it to 'site.ini' to make the system still check that but not the rest. */ 9 / 58
  • 10. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS INI CACHE How eZ stores the INI cache ? ➔ var/cache/ini ( and not /{varDir}/ini ), not clusterized ➔{inifilename}-{hash}.php design-677247a49e428aa083741 1b52777b920.php design-704216b4d0e3ea68c09742504bb366c8.php design-7333039e7e19aa41 1f8dd01836555861.php md5 FileName / RootDir / DirectAccess / overrideDirs / internalCharset 10 / 58
  • 11. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS INI CACHE How to expire the INI cache ? ➔php bin/php/ezcache.php --clear-id=global_ini ➔ Remove var/cache/ini ➔php bin/php/ezcache.php --clear-tag=ini ➔ Remove var/cache/ini & var/cache/active_extensions_{hash}.php ➔php bin/php/ezcache.php --clear-id=ini ➔ Nothing (bug) : try to recursively delete INI files in {varDir}/ini 11 / 58
  • 12. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS INI CACHE How to expire a set of INI files ? ➔ Not possible with eZ Scripts ➔ Possible & safe using a command line ➔ TEST BEFORE : find var/cache/ini -name "site-*" ➔ RM : find var/cache/ini -name "site-*" | xargs rm 12 / 58
  • 13. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS INI CACHE How to not compile the INI value ? lib/ezutils/classes/ezini.php function eZINI( $fileName = 'site.ini', $rootDir = '', $useTextCodec = null, $useCache = null, $useLocalOverrides = null, $directAccess = false, $addArrayDefinition = false, $load = true ) { ... } Dynamically load the INI values inside your compiled templates : site.ini [eZINISettings] / DynamicTemplateMode=enabled OR Ezini operator → 'dynamic' parameter 13 / 58
  • 14. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS SUMMARY CONTEXT INI CACHE TEMPLATE COMPILATION VIEWCACHE CACHE-BLOCK EXPIRY.PHP FILE EZCACHE.PHP SCRIPT QUESTIONS 14 / 58
  • 15. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS TPL COMPILATION What for ? ➔ Compile your .tpl files to .php files ➔ Reduce the RAM / CPU (use the stored compiled version) How to set ? site.ini [templatesettings] ➔ TemplateCompile=enabled ➔ Store compiled version {varDir}/cache/template/compiled/ ➔ NodeTreeCaching=enabled ( disabled by default ) ➔ Store pre-compiled version {varDir}/cache/template/tree/ Common mistake ➔ TemplateCache=enabled → template-block 15 / 58
  • 16. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS TPL COMPILATION DESIGN {varDir}/cache/template/tree {varDir}/cache/template/compiled page_mainarea.tpl {hash}-page_mainarea.php page_mainarea-{hash1}.php NodeTreeCaching=enabled page_mainarea-{hash2}.php ( disabled by default ) page_mainarea-{hash3}.php Why eZ generates several compiled files for the same .tpl? 16 / 58
  • 17. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS TPL COMPILATION How eZ stores the final compiled files ? {VarDir}/cache/template/compiled/, not clusterized Filenames : {templatename}-{hash}.php page_head-49f4458d0b68aec3cf2de63a6918fd61.php page_head-ec3cf2de63a6918fd6149f4458d0b68a.php 17 / 58
  • 18. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS TPL COMPILATION How eZ calculates the hash ? $sharedTemplates = false {VarDir}/cache/template/compiled/ Filenames : {templatename}-{hash}.php pagelayout-49f4458d0b68aec3cf2de63a6918fd61.php Md5( filepath ) / internalCharset / language / useFullUrlText / accessText / pageLayoutVariable / indexFile / extraName /layout/set/... 18 / 58
  • 19. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS TPL COMPILATION How eZ calculate the hash ? $sharedTemplates = true {VarDir}/cache/template/compiled/ Filenames : {templatename}-{hash}.php pagelayout-aec3cf2de63a6918fd6149f4458d0b68.php Md5( filepath ) / language No more siteaccess inside the key... Ezini operator → 'dynamic' parameter 19 / 58
  • 20. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS TPL COMPILATION How to pre-compile a set of template files (to avoid : on the fly generating) ? ➔ Force the compilation of 2 template files php bin/php/eztc.php -s mysiteaccess --force extension/ezwebin/design/ezwebin/templates/pagelayout.tpl extension/ezwebin/design/ezwebin/templates/page_leftmenu.tpl ➔ Force the compilation of all template files starting with « page_header_ » : find extension/ezwebin/ -name "page_header_*.tpl" | xargs php bin/php/eztc.php -s mysiteaccess –force ➔ Force the compilation of all template files from a TXT file : cat template_list.txt | xargs php bin/php/eztc.php -s mysiteaccess --force 20 / 58
  • 21. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS TPL COMPILATION The **** layout module ➔ By default ( $shareTemplates = false ), the 'layout' value is used by the final compiled filename ➔ So if you are using this module with 3 other layouts, you'll produce 4 compiled files (instead of 1) ➔ eztc.php script does not manage the layout parameter Your 3 additional compiled files ( for each layout ) will be procude « on the fly », and cannot be pre- compiled with eztc.php ➔ Suggestion : improve eztc.php, add the –layout=... parameter 21 / 58
  • 22. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS SUMMARY CONTEXT INI CACHE TEMPLATE COMPILATION VIEWCACHE CACHE-BLOCK EXPIRY.PHP FILE EZCACHE.PHP SCRIPT QUESTIONS 22 / 58
  • 23. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS VIEWCACHE What for ? ➔ Viewcache = content cache, content viewcache, … ➔ Viewcache is an HTML (or other) cache of the $module_result.content outpout, for a node view call ( content/view/... ) ← Illustration : Łukasz Serwatka http://share.ez.no/learn/ez-publish/ez-publish-performance- optimization-part-3-of-3-practical-cache-and-template-solutions/ (page)/2 23 / 58
  • 24. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS VIEWCACHE How eZ stores the viewcache ? {VarDir}/cache/content/{siteaccess}/{number}/{number}/{number} {VarDir}/cache/content/{siteaccess}/ 2-ce182234bd70236c6a009578d2a34632.cache 20-ce182234bd70236c6a009578d2a34632.cache {VarDir}/cache/content/{siteaccess}/1 101-ce182234bd70236c6a009578d2a34632.cache 105-ce182234bd70236c6a009578d2a34632.cache {VarDir}/cache/content/{siteaccess}/5/2/1 52101-ce182234bd70236c6a009578d2a34632.cache 52144-ce182234bd70236c6a009578d2a34632.cache 24 / 58
  • 25. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS VIEWCACHE How eZ stores the viewcache ? {nodeid}-{hash}.php 2-ce182234bd70236c6a009578d2a34632.cache md5 required nodeID / viewMode / layout / language (view.p.) / offset (view.p.) / indexFile optionnal + roIeIDList / limitValueList / discountList / cacheNameExtra / pr_user / viewParameters / userPreferences ViewCacheTweaks[<node_id>]=<setting>[;<setting2>] ViewCacheTweaks[global]=<setting>[;<setting2>] 25 / 58
  • 26. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS VIEWCACHE How to know the exact matching between a viewcache file & my URLs ? {nodeid}-{hash}.php → deduce the nodeID At the end of file : "view_parameters";a:6: {s:6:"offset";b:0;s:4:"year";b:0;s:5:"month";b:0;s:3:"day";b:0;s:10:"n amefilter";b:0;s:4:"test";s:1:"2";}... Should be URL : /(test)/2 26 / 58
  • 27. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS VIEWCACHE How eZ expires a set of viewcache ? Alteration of cache states - Depending of the filehandler ( file.ini ) ➔ Ezfsfilehandler : UNLINK file ➔ Ezfs2filehandler : TOUCH file (25/25/1977) ← Star Wars day ➔ Ezdbfilehandler : "ezdbfile" (UPDATE expired=1) ➔ Ezdfsfilehandler : "ezdfsfile" (UPDATE expired=1) Comparison of cache states - Depending of the filehandler ( file.ini ) ➔ Ezfsfilehandler : file does not exist, or is older than the content-view- cache timestamp ➔ Ezfs2filehandler : file is older than the content-view-cache timestamp ➔ Ezdbfilehandler : "ezdbfile" (expired=1) ➔ Ezdfsfilehandler : "ezdfsfile" (expired=1) 27 / 58
  • 28. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS VIEWCACHE How eZ expires the ENTIRE viewcache ? ➔ eZ does not recursively update / delete the files (too many files... unsafe) eZ set a global timestamp expiry value : ➔ {VarDir}/cache/expiry.php ← 'content-view-cache' ( current timestamp) Each time the expiry.php is updated, the ENTIRE viewcache will expire. ➔ Ok, but my ENTIRE viewcache expires all the time... i did nothing special ! Don't know why ! 28 / 58
  • 29. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS VIEWCACHE Which event / trigger expires a set of cache ? By default : on object publication (or back-end feature) ➔ the related nodes & parent node Willingly, using a script : ➔ bin/php/ezcontentcache.php –clear-node=2 ➔ bin/php/ezcontentcache.php –clear-node=2,46,63 ➔ bin/php/ezcontentcache.php –clear-node=/company/about ➔ bin/php/ezcontentcache.php –clear-subtree=/company/about ➔ bin/php/ezcontentcache.php –clear- subtree=/company/about,/news 29 / 58
  • 30. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS VIEWCACHE Smart viewcache & cacheThreshold : a set of cache → the ENTIRE view cache Automatically, if using the smart view cache / viewcache.ini : ➔ The smart view cache populates a list of related « node_id » viewcache files to expire, depending of your settings. If this node_id list is larger than the CacheThreshold limit value (250 by default) → eZ expires the ENTIRE viewcache ! ➔ Some settings could increase the node_id list count & excede the CacheThreshold limit : ALL, siblings, KeywordNodesCacheClearLimit ➔ Advice : Set KeywordNodesCacheClearLimit = 0, never use ALL, avoid siblings, log out the CacheThreshold (ezpEvent) 30 / 58
  • 31. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS VIEWCACHE Log the viewcache node_id list to expire, prevent the CacheThreshold limit... ➔ Add an ezpEvent : site.ini.append.php [Event] Listeners[]=content/cache@test::logviewcache # test = your PHP class name # logviewcache = the static method 31 / 58
  • 32. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS VIEWCACHE Log the viewcache node_id list to expire, prevent the CacheThreshold limit... ➔ Create a PHP class / generate autoloads <?php class test { static public function logviewcache( $nodeList ) { $uri = $GLOBALS['_SERVER']['REQUEST_URI']; eZLog::write('node_id count : '. count( $nodeList ). ' / node_id list : ' . implode(', ', $nodeList ) . ' / URI : '.$uri, 'chachethresold.log'); return $nodeList; }} ?> ➔ Log output : [ Feb 06 2012 17:48:34 ] node_id count : 5 / node_id list : 1 105, 2, 1, 78 16, / URI : /content/edit/114/2/fre-FR 32 / 58
  • 33. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS VIEWCACHE My ENTIRE viewcache still expire... Maybe you invoked one of these features (back-end, API)  : ➔ Create a new content class ( BUG ? ) ➔ Update / delete an existing content class ( or attributes ) ➔ Update / delete and existing role ( & policies ) OR role assignement ➔ Section assignement ➔ Update an ezshop rule ( discount rules, currency... ) 33 / 58
  • 34. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS 34 / 58
  • 35. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS 35 / 58
  • 36. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS SUMMARY CONTEXT INI CACHE TEMPLATE COMPILATION VIEWCACHE CACHE-BLOCK EXPIRY.PHP FILE EZCACHE.PHP SCRIPT QUESTIONS 36 / 58
  • 37. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS CACHE-BLOCK ... What for ? ➔ Template-block cache = cache files related to cache-block, also called « template cache » ( common mistake with the template compilation ) ➔ Template-block cache is an HTML (or other) cache of a template part ( cache- block ) ← Illustration : Łukasz Serwatka http://share.ez.no/learn/ez-publish/ez-publish-performance- optimization-part-3-of-3-practical-cache-and-template-solutions/ (page)/2 37 / 58
  • 38. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS CACHE-BLOCK Impact of common parameters The « keys » parameter : Please AVOID : {cache-block keys=$uri_string} 1 template-block file ... for each URI !!! {/cache-block} Use instead : {cache-block keys=$my_custom_limited_range_key} ... {/cache-block} Only possible states of your content inside your block 38 / 58
  • 39. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS CACHE-BLOCK Impact of common parameters The « URI key » parameter : stupid but signifiant simulation ➔ A classic Web site, with 1000 nodes, news folder ( year, month archives ), products catalog ( filters ), calendar, forum... ➔ Could generate 10 000 « indexable » several URI ( google bot ) ➔ A cache-block ( only 1 URI key ) to cache the global menu, who is generating 300 SQL queries ➔ No « expiry » or « ignore_content_expiry » parameters : so the cache- block expires every 2 hours (or on content publication) ➔ So... 300 SQL queries * 12 expiration per day * 10 000 URI = 36 millions of SQL queries per day... 39 / 58
  • 40. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS CACHE-BLOCK Impact of common parameters The « expiry » parameter : If possible, always set a custom expiry value & ignore content expiry : {cache-block ignore_content_expiry expiry=86400} ... {/cache-block} 40 / 58
  • 41. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS CACHE-BLOCK Impact of common parameters The « sutree_expiry » parameter : no more expiry / ignore_content_expiry needed {cache-block subtree_expiry='news/'} ... {/cache-block} {cache-block subtree_expiry=142} ... {/cache-block} 41 / 58
  • 42. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS CACHE-BLOCK Impact of common parameters The « sutree_expiry » parameter : tip of the « magic » node ➔ To expire a cache-block, depending of a custom rule ( per content class, per PHP algorithm ... ) ➔ Create a {cache-block subtree_expiry=$magic_node_id} ➔ Create a node somewhere ( safe location, without FULL view ) ➔ Create a workflow or customedithandler to include your custom rules on publication, and update the content object related to the magic node by the code 42 / 58
  • 43. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS CACHE-BLOCK Cache-block imbrication {cache-block expiry=3600} ... {cache-block ignore_content_expiry expiry=86400} ... {* you save … SQL Queries each hours *} {/cache-block} ... {cache-block subtree_expiry='news/'} ... {/cache-block} ... {/cache-block} 43 / 58
  • 44. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS CACHE-BLOCK I need a « real time » block ( TTL=1m ) A cache-block may not be the solution, use instead : ➔ ESI ( Edge Side Include ) : better for front-end loading & google bot indexing. But reverse-proxy required ( varnish, squid, akamai... ) ➔ AJAX : easier to implement 44 / 58
  • 45. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS CACHE-BLOCK How eZ stores the template-block cache {VarDir}/cache/template-block/1/2/3/12345678.cache {VarDir}/cache/template-block/5/5/5/555666888.cache {VarDir}/cache/template-block/subtree/1/5/9/cache/1/2/3/12345678.cache subtree_expiry=159 CRC32 Complex... The pathname doesn't help 45 / 58
  • 46. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS CACHE-BLOCK How eZ stores the template-block cache {VarDir}/cache/template-block/1/2/3/12345678.cache CRC32 ( 32-bit polynomial checksum ) Cache-block position in the .tpl file / template path / keys / siteaccess 78_1_78_94_extension/ezwebin/design/ezwebin/templates/pagelayout.tpl 78 = {cache-block... } line start 1 = {cache-block... } column start (a simple ' ' before...) 78 = {cache-block... } line end 94 = {cache-block... } column end 46 / 58
  • 47. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS CACHE-BLOCK How to expire the ALL of the template- block cache files ? php bin/php/ezcache.php –clear-id=template-block ➔ Expires all the template-block files, by updating the global cache-block expiry time ( global-template-block-cache ) in the {varDir}/expiry.php file 47 / 58
  • 48. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS CACHE-BLOCK How to expire a set of specific template- block cache files ? ➔ Not really possible... exept by searching a specific string inside each files, and deleting matching files ( ezfs / ezFS2 ) ➔ find var/myvardir/cache/template-block/ -mmin -10 -name "*.cache" -exec grep -iHl "ID:BLOCK1" {} ; | xargs rm {cache-block ignore_content_expiry expiry=0} <!-- ID:BLOCK1 --> ... {/cache-block} 48 / 58
  • 49. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS CACHE-BLOCK PULL REQUEST IDEA : {cache-block id=myfolder ignore_content_expiry expiry=0} <!-- ID:BLOCK1 --> ... {/cache-block} {VarDir}/cache/template-block/myfolder/1/2/3/12345678.cache So... to expire your cache-block : mv myfolder myfolder-to-remove nice -n 20 rm -r myfolder-to-remove 49 / 58
  • 50. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS SUMMARY CONTEXT INI CACHE TEMPLATE COMPILATION VIEWCACHE CACHE-BLOCK EXPIRY.PHP FILE EZCACHE.PHP SCRIPT QUESTIONS 50 / 58
  • 51. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS EXPIRY.PHP FILE <?php What for ? $Timestamps = array ( 'state-limitations' => 1321010927, 'user-info-cache' => 1323788789, ➔ To globally expire a cache, eZ 'content-view-cache' => 1326299075, Publish update the related value 'class-identifier-cache' => 1326298969, 'global-template-block-cache' => 1325856140, with the current timestamp. 'content-tree-menu' => 1326298969, 'image-manager-alias' => 1323788788, ➔ eZ Publish compares « on the fly » 'active-extensions-cache' => 1325668728, this updated value with each 'ts-translation-cache' => 1323788789, 'content-complex-viewmode-cache' => 1325780763, caches mtime, always older 'template-block-cache' => 1326298969, 'user-class-cache' => 1326298969, 'sort-key-cache' => 1326298969, ); 51 / 58
  • 52. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS SUMMARY CONTEXT INI CACHE TEMPLATE COMPILATION VIEWCACHE CACHE-BLOCK EXPIRY.PHP FILE EZCACHE.PHP SCRIPT CONCLUSION 52 / 58
  • 53. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS EZCACHE.PHP SCRIPT FAMOUS EZSCRIPT php bin/php/ezcache.php --clear-id=[ID] php bin/php/ezcache.php --clear-id=[ID] --purge php bin/php/ezcache.php --clear-tag=[TAG] php bin/php/ezcache.php --clear-tag=[TAG] --purge php bin/php/ezcache.php --clear-all php bin/php/ezcache.php --clear-all --purge NEED SOME HELP Does it do something php bin/php/ezcache.php --help special ? Superstitious php bin/php/ezcache.php --list-ids parameter php bin/php/ezcache.php --list-tags 53 / 58
  • 54. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS EZCACHE.PHP SCRIPT TAG ID content content / classid / sortey / urlalias / rss_cache / content_tree_menu / state_limiations / template- block / ezjscore-packer template template / template-block / template-override / texttoimage / design_base / ezjscore-packer ini ini / global_ini / active_extensions user user_info_cache I18n translation / chartrans codepage codepage image imagealias rest rest / rest-routes 54 / 58
  • 55. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS EZCACHE.PHP SCRIPT MAIN ALGORITHM Hardcoded in kernel/classes/ezcache.php. For each ID : 'id' => ID 'tag' => array( TAG LIST ) 'enabled' => Cache enabled or not 'is-clustered' => Use the current filehandler or not ? 'path' => Path to purge, if purging (is-clustered=false) 'expiry-key' => Key to set inside the expiry.php file if needed 'function' => Function to apply only on clearing (not purging) 'function-purge' => Function to apply only on purging (not clearing) 55 / 58
  • 56. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS EZCACHE.PHP SCRIPT MAIN ALGORITHM Add your own ID for your extensions ( site.ini.append.php ) # Cache item entry (for eZ Publish 4.3 and up) [Cache] CacheItems[]=ezjscore [Cache_ezjscore] name=eZJSCore Public Packer cache id=ezjscore-packer tags[]=content tags[]=template path=public isClustered=true 56 / 58
  • 57. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS EZCACHE.PHP SCRIPT A BUG HELPS TO UNDERSTAND php bin/php/ezcache.php --clear-id=ini array( 'name' => ezpI18n::tr( 'kernel/cache', 'INI cache' ), 'id' => 'ini', 'tag' => array( 'ini' ), 'enabled' => true, 'path' => 'ini' ), Why is it not working ? 57 / 58
  • 58. :~$ eZ Publish Caching Mechanisms // SPICY DETAILS SUMMARY CONTEXT INI CACHE TEMPLATE COMPILATION VIEWCACHE CACHE-BLOCK EXPIRY.PHP FILE EZCACHE.PHP SCRIPT QUESTIONS 58 / 58