[dokuwiki] Re: function result caching (formerly search improvements)
- From: Chris Smith <chris@xxxxxxxxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Sun, 27 Aug 2006 11:31:38 +0100
Ben Coburn wrote:
Well... I guess there is no justification in the *current* code, but
the patch I'm working on also imports data into the cache from
getRevisions(). [IMHO, "static" just sounds strange when not talking
about classes. :-) ]
Good to know.
I did mine as static as I could then cut out the is_array() check.
CleanID caching could be very successful. I am getting cache hit rates
above 50% for most DokuWiki actions. I also put a cache in WikiFN, that
is less successful generally, but effective for backlinks.
I'll do some more profiling (not the most exciting thing in the world
;-) ) to see what effect these have.
I'd also like to try and centralise the caching via a function or
object. That would make it easier to add/remove caches. It should also
make it possible for developers (with suitable debug and/or cache
switches) to track cache hit rates and cache sizes.
My initial idea is something along the lines of:
cache_exists($cache_name, $params);
cache_set($cache_name, $params, $value);
cache_retrieve($cache_name, $params);
cache_name would normally be the name of the function using the cache,
e.g. cleanID.
params would be an array of indexes into the cache, e.g. id, rev
use would be
if (cache_exists(...)) return cache_retrieve(...);
... main function body ...
cache_set(..., value);
return value;
What do you think?
Would the overhead be too great?
Would you still be able to work with something like that for your
revision_info cache?
Cheers,
Chris
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist
Other related posts: