Pandos, I don't remember where we talked about this, but since there's already a topic for that, I'll just reuse it... (You can see from the wedge.org stats that technically, I'm a 'topic re-use' guy, whereas Arantor was a 'new topic crazy' guy...)
So, I've been looking into memcached (for some obscure unrelated reason), and installed a server on my PC, and wasn't thrilled to see that it didn't work.
The reason was pretty stupid, actually. I'm even wondering if SMF has got it right, either...
- reloadSettings load $modSettings, which it does through the cache.
- cache checks $modSettings (which is empty), and determines memcached isn't available. Load from file? Doesn't have anything.
- it then rebuilds the settings from DB, and proceeds to save it to the cache...
- cache checks $modSettings (which is no longer empty), and then saves to memcached. As a result, that entry will never be loaded by reloadSettings, which will continuously rebuild the $modSettings cache. For nothing.
In Wedge, it was a similar codepath, except that $settings ($modSettings) was only checked once; because memcached wasn't available, it would then use the file cache, and effectively keep using it later. So, Wedge is less buggy in that area, although it's due to another bug...
I've fixed it locally, by saving the memcached server data to a Settings.php variable instead. Because it's already loaded by the time $settings reloads from cache, we can effectively reload from memcached. Works.
There are still 3 outstanding bugs, although minor:
- language files don't seem to be stored through memcached. They still use the file cache. I'm not exactly sure why it was done that way. I'm going to assume it was for a reason, so I'll leave it aside for now.
- An admin area issue that forces me to re-enter the memcached server every time I go to that page. No biggie, will fix.
- And related to your topic: there is no php_memcached.dll file for Windows, meaning I can't even begin to test Memcached in Wedge.
This is relatively important to me, because it shouldn't be a big deal to implement this, but I looked into the SMF 2.1 code and they just basically replace memcache_* calls with memcached_* calls, and I can't for the life of me, find any documentation on the procedural versions of Memcached methods. Do they even exist...?!