Hey James,

Great that you are looking into this. Are you aware of Nicschayns Summer of Code project [0]? He'll be doing stuff in this direction. Better coordinate to avoid both doing the same work in parallel :)

I think your approach is good in general, as an easy-to-implement tweak that can have quite a big impact on performance even though not as much as more complex caching strategies might.

> public function getHash() { return md5( $this->m_querystring . $this->m_limit . serialize( $this->m_extraprintouts ) ); }

Since stuff here is not sorted, you can have the same query with different hashes. Might be easy to sort in some way and not have this.

> The cache object is generated using the $wgMemc class

I'm in favor of using wfGetCache( CACHE_ANYTHING ).

To wrap up: I think this is ok, although the integration could be better. One concern I have is that if this is enabled, and you change something that you want to see reflected in your query right away, there is no way to invalidate the cache. If that gets addressed, such a change can go in SMW as far as I'm concerned. Improving the integration can be done later, although this might not be much later, depending on Nicschayns progress.

[0] https://www.mediawiki.org/wiki/User:Nischayn22/Gsoc

Cheers

--
Jeroen De Dauw
http://www.bn2vs.com
Don't panic. Don't be evil.
--