Hi Leonard,

there's an Oxid Smarty plugin oxid_nocache. That gave me the idea to turn it
around and make it oxid_cache:

/*
* Smarty plugin
* -------------------------------------------------------------
* File: insert.oxid_cache.php
* Type: string, html
* Name: oxid_cache
* Purpose: Inserts Items cached
* -------------------------------------------------------------
*/
function smarty_insert_oxid_cache($params, &$smarty)
{   $smarty->caching = true;
    $smarty->cache_lifetime = -1;

    $sCacheId = oxLang::getInstance()->getBaseLanguage().(int)
oxConfig::getParameter( 'currency' );
    if(strlen($sCacheId<2))$sCacheId="00";
    $sOutput = $smarty->fetch( $params['tpl'].$sCacheId.".tpl");

    $smarty->caching = false;

    return $sOutput;
}



Now any template included via this plugin will be cached by Smarty.

I set the lifetime to "forever", meaning it will live as long as the
contents of the tmp-folder. You can of course change that.

One issue that has to be dealt with are the language and currency variants.
We only use German and Euro, so it was easier for me - you will see in
practice. What you need is one variant of the included template with the
appropriate file name ending 00, 01, 10, 11, .... (and of course depending
on what sequence the current Oxid version uses these....)

Best,
Achim



> -----Ursprüngliche Nachricht-----
> Von: [email protected]
> [mailto:[email protected]]Im Auftrag von Leonard
> Kramer
> Gesendet: Montag, 23. Mai 2011 22:55
> An: [email protected]
> Betreff: Re: [oxid-dev-general] Smarty Caching deactivated
>
>
> Hello Achim,
>
> your approach sounds very interesting. So you're basically only caching
> specific components of the site?
> Can you explain a little bit more in detail how you achieve this.
>
> Best regards,
>
> Leonard Kramer
>
> Am 23.05.2011 15:49, schrieb Achim Leinberger:
> > Hi,
> >
> > I use Smarty-Caching activated locally for the Header-Nav-Template, so I
> > save on loading the category tree - works without any issues.
> >
> > Best,
> > Achim
> >
> > -----Ursprüngliche Nachricht-----
> > Von: [email protected]
> > [mailto:[email protected]] Im Auftrag von Leonard
> > Kramer
> > Gesendet: Montag, 23. Mai 2011 11:29
> > An: [email protected]
> > Betreff: [oxid-dev-general] Smarty Caching deactivated
> >
> > Hello everbody,
> >
> > I'm currently facing the challenge that our OXID eShop has a
> execution time
> > of 4 - 7 seconds due to the heavy usage of variants and articlelists.
> >
> > When researching optimization alternatives, I found the
> following line in
> > oxutilsview.php:
> >
> > 323 // $myConfig->blTemplateCaching; // DODGER #655 : permanently
> > switched off as it doesnt work good enough
> > 324 $oSmarty->caching      = false;
> >
> > Can I get a more detailled description of "DOGER #655" (I didn't find
> > something in the OXID bugtracker) or can somebody tell me the
> reasons for
> > switching Smarty caching off?
> >
> > When I activate smarty caching my execution time is about 1
> second, so this
> > would be a very interesting optimization option.
> >
> > Thank you and best regards
> >
> > Leonard Kramer
> >
> > --
> > Sonntagmorgen.com <http://www.sonntagmorgen.com> - Zeit für guten Kaffee
> > Tel. 0251-29794-333 / Fax 0251-29794-334 Sonntagmorgen Kaffee / Till
> > Achinger / Mendelstr. 11 / 48149 Münster
> > _______________________________________________
> > dev-general mailing list
> > [email protected]
> > http://dir.gmane.org/gmane.comp.php.oxid.general
> >
> >
> > _______________________________________________
> > dev-general mailing list
> > [email protected]
> > http://dir.gmane.org/gmane.comp.php.oxid.general
> _______________________________________________
> dev-general mailing list
> [email protected]
> http://dir.gmane.org/gmane.comp.php.oxid.general
>


_______________________________________________
dev-general mailing list
[email protected]
http://dir.gmane.org/gmane.comp.php.oxid.general

Reply via email to