SlideShare ist ein Scribd-Unternehmen logo
1 von 39
Downloaden Sie, um offline zu lesen
JOOMLA! 1.6. CACHE
     //implemented //
JOOMLA! CACHING TYPOLOGY
// Cache types coverage //
template



component



modules



module



functions
                                  limited to component




                                                                  limited to modules




                                                                                                limited to module
smaller
units

            page cache   component                       progressive                   module                       function/callback   output cache
                         view cache                         cache                      cache                              cache          raw cache
page cache




// Cache types coverage //
component view cache




// Cache types coverage //
progressive cache




// Cache types coverage //
module cache
e.g. mod_latestnews




// Cache types coverage //
function cache
output                       Caching smaller units inside
raw cache                    framework and extensions
                             (not directly visible)




// Cache types coverage //
multiple caches =
multiple layers




// Cache types coverage //
multiple caches =
multiple layers




// Cache types coverage //
PAGE CACHE
Takes snapshots of entire pages including everything -
component, modules, plugins and a template.

The widest and the least flexible approach of all caching
options.
// enabled by core system plugin -> site administrators choice //
PROGRESSIVE
   CACHE
Takes snapshot of each unique modules set (typicaly each
page)

Affects all modules - works as layer above module cache.
// enabled by setting cache level to progressive -> site administrators choice. For fine
grained control over each module cache use conservative caching level. //
MODULE & COMPONENT
    VIEW CACHE
Most widespread cache type, sometimes equaled with J
caching in general.


       Performs well in the speed terms


       Disables any
       user<->extension<->framework
       interaction until a cached copy has expired

Not suitable for any components or modules that react to
user actions or render frequently changing content.
COMPONENT VIEW CACHE

Takes an array of url parameters and their types to create
Cacheid.

A replacement for a previous unsafe way which took the
whole URL and so opened the doors for DOS attacks via
random parameters/values added to request
// Old cacheid created from URL retained for backwards compatibility if there are no
$safeurlparams (to be removed in 1.7) //
Com_contact controler usage example:
$safeurlparams = array('id'=>'INT', 'catid'=>'INT', 'limit'=>'INT',
'limitstart'=>'INT', 'filter_order'=>'CMD', 'filter_order_Dir'=>'CMD’,
'lang'=>'CMD');

parent::display($cachable,$safeurlparams);
MODULE CACHE

5 different modes of operation, 3 of them are to be set
from module XML file, while 2 are meant to be used from
within the module itself.

Default is backwards compatible oldstatic mode that
requires no changes to a module.
MODES TO BE SET IN XML

Static - one cache file for all pages with the same module
parameters.
Recommended for modules that don't change.

Oldstatic - 1.5. definition of module caching, one cache
file for all pages with the same module id and user aid.
Default for backwards compatibility
MODES TO BE SET IN XML

Itemid - changes on itemid change.

Suitable for most dynamic modules that change per page
- like menus, breadcrumbs, content images etc
In addition to cache field that was required in 1.5 there is
now new hidden field in module XML called cachemode
that sets any of the above modes.
<field name="cachemode"
type="hidden"
default="static">
<option value="static"></option>
</field>
MODES TO BE CALLED FROM INSIDE THE MODULE:

Safeuri - id is created from URL params array, as in
component view cache

Use this mode if you module depends on url parameters
other than Itemid to display content (e.g. module that
display different image for each content category).

Modeparams property is an array of url parameters and
their filter types
MODES TO BE CALLED FROM INSIDE THE MODULE:

Id - module sets own cache id's according to it's own
formula.

Most flexible, but not needed often.

Modeparams property is calculated id.
To use this modes rename 'cache' field in xml to
'owncache' field and call JModuleHelper::ModuleCache from within
the module's main php file.



// actually a shortcut to cache callback to avoid code duplication in every module //
An example that uses safeuri mode
$list = modRelatedItemsHelper::getList($params) :

$cacheparams->modeparams = array('id'=>'int','Itemid'=>'int');
$cacheparams->methodparams = $params;
$cacheparams->method = 'getList';
$cacheparams->class = 'modRelatedItemsHelper';
$cacheparams->cachemode = 'safeuri';
$cacheparams = new stdClass;

$list = JModuleHelper::ModuleCache ($module, $params, $cacheparams);
FUNCTION / CALLBACK
       CACHE
The first of flexible caching types that enable us to
differentiate between various parts of the extension and
cache only those parts that are cacheable, while keeping
dynamic parts uncached.
Caches results of function calls

Records (cacheID) based on the arguments passed to the
function
Often useful to cache model methods and keep views
uncached.

Example use
Model performing expensive queries or similar operations
is run only once to create a larger pool of data which is
then further manipulated inside the view (sorting,
pagination, calculations etc.)
OUTPUT CACHE
Caches output of some part od the script

Records based on id passed
Basically output buffering with caching
RAW CACHE
Caches any data units

Records based on id passed
Fully controlled by the coder – what, when to store, how
to classify stored units (cache id).

Highly useful when we are dealing with finite number of
reusable data units
Example use
High number of possible combinations of relatively small
number of units – e.g. products in online store. No point
to cache multiple parameter searches, cache each product
separately.


Other examples
Expensive queries, remote XML, thumbnails, reusable
texts or any reusable data set.
Also useful to pass large amounts of data between
different parts of application (e.g. steps in click flow)

Used in Joomla core: list of components, list of modules,
menu tree, available languages, user groups, html
renderers etc.
Raw cache get and store are easily accesed by passing ''
(empty string) as cache controller to JFactory::getCache
Data is auto serialized / deserialized

Locking & unlocking are performed automaticaly

Weitere ähnliche Inhalte

Ähnlich wie Joomla 1.6. caching implemented #jab11

Magento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module developmentMagento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module developmentIvan Chepurnyi
 
HTTP Session Replication with Oracle Coherence, GlassFish, WebLogic
HTTP Session Replication with Oracle Coherence, GlassFish, WebLogicHTTP Session Replication with Oracle Coherence, GlassFish, WebLogic
HTTP Session Replication with Oracle Coherence, GlassFish, WebLogicOracle
 
Liberty dynacache ffw_iea_ste
Liberty dynacache ffw_iea_steLiberty dynacache ffw_iea_ste
Liberty dynacache ffw_iea_steRohit Kelapure
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesExove
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance Sitesdrupalcampest
 
Webpack Introduction
Webpack IntroductionWebpack Introduction
Webpack IntroductionAnjali Chawla
 
Java programing considering performance
Java programing considering performanceJava programing considering performance
Java programing considering performanceRoger Xia
 
Introduction to OSGi
Introduction to OSGiIntroduction to OSGi
Introduction to OSGipradeepfn
 
Mongo performance tuning: tips and tricks
Mongo performance tuning: tips and tricksMongo performance tuning: tips and tricks
Mongo performance tuning: tips and tricksVladimir Malyk
 
Cocoon Blocks ApacheCon US 2005
Cocoon Blocks ApacheCon US 2005Cocoon Blocks ApacheCon US 2005
Cocoon Blocks ApacheCon US 2005Daniel Fagerstrom
 
Caching technology comparison
Caching technology comparisonCaching technology comparison
Caching technology comparisonRohit Kelapure
 
Mageguru - magento custom module development
Mageguru -  magento custom module development Mageguru -  magento custom module development
Mageguru - magento custom module development Mage Guru
 
Magento mega menu extension
Magento mega menu extensionMagento mega menu extension
Magento mega menu extensionBun Danny
 
webpack introductionNotice Demystifyingf
webpack introductionNotice Demystifyingfwebpack introductionNotice Demystifyingf
webpack introductionNotice DemystifyingfMrVMNair
 
Front-end optimisation & jQuery Internals
Front-end optimisation & jQuery InternalsFront-end optimisation & jQuery Internals
Front-end optimisation & jQuery InternalsArtur Cistov
 
Odoo (Build module, Security, ORM)
Odoo (Build module, Security, ORM)Odoo (Build module, Security, ORM)
Odoo (Build module, Security, ORM)sroo galal
 
Modules all the way down: OSGi and the Java Platform Module System
Modules all the way down: OSGi and the Java Platform Module SystemModules all the way down: OSGi and the Java Platform Module System
Modules all the way down: OSGi and the Java Platform Module SystemTim Ellison
 
Wp8.5 p06 themes basics
Wp8.5 p06 themes basicsWp8.5 p06 themes basics
Wp8.5 p06 themes basicstestkiller
 
Template Layout Overrides - a beginner's guide
Template Layout Overrides - a beginner's guideTemplate Layout Overrides - a beginner's guide
Template Layout Overrides - a beginner's guideRuth Cheesley
 

Ähnlich wie Joomla 1.6. caching implemented #jab11 (20)

Magento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module developmentMagento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module development
 
HTTP Session Replication with Oracle Coherence, GlassFish, WebLogic
HTTP Session Replication with Oracle Coherence, GlassFish, WebLogicHTTP Session Replication with Oracle Coherence, GlassFish, WebLogic
HTTP Session Replication with Oracle Coherence, GlassFish, WebLogic
 
Liberty dynacache ffw_iea_ste
Liberty dynacache ffw_iea_steLiberty dynacache ffw_iea_ste
Liberty dynacache ffw_iea_ste
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance Sites
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance Sites
 
Webpack Introduction
Webpack IntroductionWebpack Introduction
Webpack Introduction
 
Java programing considering performance
Java programing considering performanceJava programing considering performance
Java programing considering performance
 
Introduction to OSGi
Introduction to OSGiIntroduction to OSGi
Introduction to OSGi
 
Mongo performance tuning: tips and tricks
Mongo performance tuning: tips and tricksMongo performance tuning: tips and tricks
Mongo performance tuning: tips and tricks
 
Cocoon Blocks ApacheCon US 2005
Cocoon Blocks ApacheCon US 2005Cocoon Blocks ApacheCon US 2005
Cocoon Blocks ApacheCon US 2005
 
Caching technology comparison
Caching technology comparisonCaching technology comparison
Caching technology comparison
 
Mageguru - magento custom module development
Mageguru -  magento custom module development Mageguru -  magento custom module development
Mageguru - magento custom module development
 
Magento mega menu extension
Magento mega menu extensionMagento mega menu extension
Magento mega menu extension
 
webpack introductionNotice Demystifyingf
webpack introductionNotice Demystifyingfwebpack introductionNotice Demystifyingf
webpack introductionNotice Demystifyingf
 
Front-end optimisation & jQuery Internals
Front-end optimisation & jQuery InternalsFront-end optimisation & jQuery Internals
Front-end optimisation & jQuery Internals
 
Odoo (Build module, Security, ORM)
Odoo (Build module, Security, ORM)Odoo (Build module, Security, ORM)
Odoo (Build module, Security, ORM)
 
Modules all the way down: OSGi and the Java Platform Module System
Modules all the way down: OSGi and the Java Platform Module SystemModules all the way down: OSGi and the Java Platform Module System
Modules all the way down: OSGi and the Java Platform Module System
 
SCSS Styleguide
SCSS StyleguideSCSS Styleguide
SCSS Styleguide
 
Wp8.5 p06 themes basics
Wp8.5 p06 themes basicsWp8.5 p06 themes basics
Wp8.5 p06 themes basics
 
Template Layout Overrides - a beginner's guide
Template Layout Overrides - a beginner's guideTemplate Layout Overrides - a beginner's guide
Template Layout Overrides - a beginner's guide
 

Kürzlich hochgeladen

Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 

Kürzlich hochgeladen (20)

20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 

Joomla 1.6. caching implemented #jab11

  • 1. JOOMLA! 1.6. CACHE //implemented //
  • 3. // Cache types coverage // template component modules module functions limited to component limited to modules limited to module smaller units page cache component progressive module function/callback output cache view cache cache cache cache raw cache
  • 4. page cache // Cache types coverage //
  • 5. component view cache // Cache types coverage //
  • 6. progressive cache // Cache types coverage //
  • 7. module cache e.g. mod_latestnews // Cache types coverage //
  • 8. function cache output Caching smaller units inside raw cache framework and extensions (not directly visible) // Cache types coverage //
  • 9. multiple caches = multiple layers // Cache types coverage //
  • 10. multiple caches = multiple layers // Cache types coverage //
  • 12. Takes snapshots of entire pages including everything - component, modules, plugins and a template. The widest and the least flexible approach of all caching options. // enabled by core system plugin -> site administrators choice //
  • 13. PROGRESSIVE CACHE
  • 14. Takes snapshot of each unique modules set (typicaly each page) Affects all modules - works as layer above module cache. // enabled by setting cache level to progressive -> site administrators choice. For fine grained control over each module cache use conservative caching level. //
  • 15. MODULE & COMPONENT VIEW CACHE
  • 16. Most widespread cache type, sometimes equaled with J caching in general. Performs well in the speed terms Disables any user<->extension<->framework interaction until a cached copy has expired Not suitable for any components or modules that react to user actions or render frequently changing content.
  • 17. COMPONENT VIEW CACHE Takes an array of url parameters and their types to create Cacheid. A replacement for a previous unsafe way which took the whole URL and so opened the doors for DOS attacks via random parameters/values added to request // Old cacheid created from URL retained for backwards compatibility if there are no $safeurlparams (to be removed in 1.7) //
  • 18. Com_contact controler usage example: $safeurlparams = array('id'=>'INT', 'catid'=>'INT', 'limit'=>'INT', 'limitstart'=>'INT', 'filter_order'=>'CMD', 'filter_order_Dir'=>'CMD’, 'lang'=>'CMD'); parent::display($cachable,$safeurlparams);
  • 19. MODULE CACHE 5 different modes of operation, 3 of them are to be set from module XML file, while 2 are meant to be used from within the module itself. Default is backwards compatible oldstatic mode that requires no changes to a module.
  • 20. MODES TO BE SET IN XML Static - one cache file for all pages with the same module parameters. Recommended for modules that don't change. Oldstatic - 1.5. definition of module caching, one cache file for all pages with the same module id and user aid. Default for backwards compatibility
  • 21. MODES TO BE SET IN XML Itemid - changes on itemid change. Suitable for most dynamic modules that change per page - like menus, breadcrumbs, content images etc
  • 22. In addition to cache field that was required in 1.5 there is now new hidden field in module XML called cachemode that sets any of the above modes. <field name="cachemode" type="hidden" default="static"> <option value="static"></option> </field>
  • 23. MODES TO BE CALLED FROM INSIDE THE MODULE: Safeuri - id is created from URL params array, as in component view cache Use this mode if you module depends on url parameters other than Itemid to display content (e.g. module that display different image for each content category). Modeparams property is an array of url parameters and their filter types
  • 24. MODES TO BE CALLED FROM INSIDE THE MODULE: Id - module sets own cache id's according to it's own formula. Most flexible, but not needed often. Modeparams property is calculated id.
  • 25. To use this modes rename 'cache' field in xml to 'owncache' field and call JModuleHelper::ModuleCache from within the module's main php file. // actually a shortcut to cache callback to avoid code duplication in every module //
  • 26. An example that uses safeuri mode $list = modRelatedItemsHelper::getList($params) : $cacheparams->modeparams = array('id'=>'int','Itemid'=>'int'); $cacheparams->methodparams = $params; $cacheparams->method = 'getList'; $cacheparams->class = 'modRelatedItemsHelper'; $cacheparams->cachemode = 'safeuri'; $cacheparams = new stdClass; $list = JModuleHelper::ModuleCache ($module, $params, $cacheparams);
  • 28. The first of flexible caching types that enable us to differentiate between various parts of the extension and cache only those parts that are cacheable, while keeping dynamic parts uncached.
  • 29. Caches results of function calls Records (cacheID) based on the arguments passed to the function
  • 30. Often useful to cache model methods and keep views uncached. Example use Model performing expensive queries or similar operations is run only once to create a larger pool of data which is then further manipulated inside the view (sorting, pagination, calculations etc.)
  • 32. Caches output of some part od the script Records based on id passed
  • 35. Caches any data units Records based on id passed
  • 36. Fully controlled by the coder – what, when to store, how to classify stored units (cache id). Highly useful when we are dealing with finite number of reusable data units
  • 37. Example use High number of possible combinations of relatively small number of units – e.g. products in online store. No point to cache multiple parameter searches, cache each product separately. Other examples Expensive queries, remote XML, thumbnails, reusable texts or any reusable data set.
  • 38. Also useful to pass large amounts of data between different parts of application (e.g. steps in click flow) Used in Joomla core: list of components, list of modules, menu tree, available languages, user groups, html renderers etc.
  • 39. Raw cache get and store are easily accesed by passing '' (empty string) as cache controller to JFactory::getCache Data is auto serialized / deserialized Locking & unlocking are performed automaticaly