View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000242 | WackoWiki | cache | public | 2008-10-27 08:30 | 2009-08-19 09:38 |
Reporter | administrator | Assigned To | administrator | ||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | resolved | Resolution | fixed | ||
Target Version | 4.3.rc | Fixed in Version | 4.3.rc | ||
Summary | 0000242: implement cache in NpjTranslit | ||||
Description | Simple per-request cache to speed up this lame but often called function. Check if there already was such a transliteration request and return its result. Otherwise transliterate as usual and store the result in this cache. | ||||
Steps To Reproduce | http://svn.wackowiki.org/viewvc/wackofork?view=rev&revision=59 back port to http://svn.wackowiki.org/viewvc/wackowiki/trunk/wacko/classes/wacko.php?view=log | ||||
Additional Information | many thanks to banshee1 | ||||
Tags | No tags attached. | ||||
Attached Files | wacko.php.patch (952 bytes)
Index: wacko.php =================================================================== --- wacko.php (revision 190) +++ wacko.php (working copy) @@ -362,6 +362,13 @@ function NpjTranslit($tag, $strtolow = TRAN_LOWERCASE, $donotload=TRAN_LOAD) { + # Lookup transliteration result in the cache and return it if found + static $npj_cache; + $cach_key = $tag.$strtolow.$donotload; + if (isset($npj_cache[$cach_key])) { + return $npj_cache[$cach_key]; + } + $_lang = null; if (!$this->GetConfigValue("multilanguage")) $donotload = 1; if (!$donotload) @@ -394,7 +401,11 @@ if ($_lang) $this->SetLanguage($_lang); - return rtrim($tag, "/"); + $result = rtrim($tag, "/"); + + # Put transliteration result in the cache + $npj_cache[$cach_key] = $result; + return $result; } function Translit($tag, $direction=1) { //deprecated | ||||
Date Modified | Username | Field | Change |
---|---|---|---|
2008-10-27 08:30 | administrator | New Issue | |
2008-10-27 08:30 | administrator | Legacy | => NEW |
2008-10-27 08:31 | administrator | File Added: wacko.php.patch | |
2008-10-27 08:37 | administrator | Assigned To | => administrator |
2008-10-27 08:37 | administrator | Status | new => assigned |
2008-10-27 08:41 | administrator | Additional Information Updated | |
2008-10-27 11:16 | administrator | Note Added: 0000533 | |
2008-10-27 11:16 | administrator | Status | assigned => resolved |
2008-10-27 11:16 | administrator | Resolution | open => fixed |
2008-10-27 11:16 | administrator | Fixed in Version | => 5.0.0 |
2008-10-27 11:16 | administrator | Target Version | => 5.0.0 |
2009-08-19 09:25 | administrator | Fixed in Version | 5.0.0 => 4.3.rc |
2009-08-19 09:38 | administrator | Target Version | 5.0.0 => 4.3.rc |
2010-03-08 10:11 | administrator | Category | Cache => cache |