Knowledgebase



 Categories





 Dimofinf Mobile


Subscribe now to Dimofinf Mobile and enjoy a wide range of premium services. You will receive our SMS text messages wherever you are for a very low cost! More


 Currency Converter


  • Currency
  • US$ Amount

Cache system



Dimofinf sets forth another professional smooth system for temporary saving of webpages (Cache) and there are some basic points we need you to know first:

  • Cache files are saved in the following path 'contents/cache'.
  • The cache retaining period for pages before deleting them and assigning new cache files is determined according to the 'cache reservation period' settings in Dimofinf settings.
  • The cache mechanism works as follows, in the beginning of the action, the function 'startcache()' is called and the action is added within the 'IF' conditional function to verify the reference value from the function where the function verifies whether there is a cache file for the current page or not. If a file is available, it displays it and doesn't execute the rest of the action steps. If a file isn't available, the action is executed and at the end, a copy of the action results is saved including its variable as a cache file within the cache folder.

Cache functions and constants:

  • define('CACHEGROUP', THIS_PRODUCT);

This constant defines the main group underneath which cache files and their different variables are saved noting that the value of this constant can be the module name, the page or whatever you want.

Example:

PHP :
{* php buffer start *} define('THIS_PRODUCT''article');
define('CACHEGROUP'THIS_PRODUCT); 
{* php buffer end *}

  •  startcache(CACHEGROUP)

This function is called at the beginning of the action within the PHP code. This function tests cache files to verify whether these is a cache file for the desired page or not and if there is a cache file, it reads it and returns its read value.

  • endcache(CACHEGROUP)

This function is called at the end of the action within the PHP code. It prints the content of the cache file if available. It also deletes the file if it is old and exceeds the cache reservation period and creates a cache file if there isn't one available.                                                   

An example for explaining cache:

PHP :
{* php buffer start *} define('THIS_PRODUCT''article');
define('CACHEGROUP'THIS_PRODUCT);
if(
$dimofinf->GPC['action'] == "l" && !$dimofinf->GPC['id'])
{
$cachedata = startcache(CACHEGROUP);
if(
$cachedata === false)
{
// Action steps executing
mk_template("template.htm");
..
..
$tpl->printToScreen();
}
endcache(CACHEGROUP);

{* php buffer end *}


Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article


Online