-
MODX Staff
- 10,725 Posts
You can use memcached for some things in MODX, but be careful because any item that you attempt to cache over 1Mb in size will simply not be cached. Just silently discarded by memcached unless you can tweak your server to allow larger memcached sizes.
There are also limitations on this in 2.0.x that have been refactored for 2.1 to allow more flexibility. For instance, in 2.0.x, you cannot change the cache_system_settings because they are loaded before the system settings are, thus this has to be configured in the config file (which will be possible in 2.1.x). That said, you can cache resources and such in other providers by configuring the proper cache settings, e.g. cache_resource_handler = cache.xPDOMemCache.
I’ll have some updated documentation soon with all the changes and improvements coming for 2.1 regarding the caching system.
Hi Jason,
any news on this? I tried to replace xPDOFilCache with xPDOMemCache in the manager but then I tried to clear the cache and got errors so I guess everything isn’t ready is it?
Regards
-
MODX Staff
- 10,725 Posts
xPDOMemCache works fine for me when configured properly, but there are some caveats when using memcached to cache things in MODX. The biggest one is that nothing over 1Mb will ever get cached unless you compile memcached specifically to handle large cache item sizes. This means if you use it for the context_settings cache and any context is over 1Mb in size, you will never have it cached. You also need to spread the different partitions of the MODX cache across different memcached server instances, otherwise when you clear any partition, all of the rest of the partitions would also be cleared because memcached does not support deleting keys via patterns (as do the xPDOFileCache, xPDOAPCCache and xPDOWinCache implementations), e.g. $modx->cacheManager->delete(’/foo/’); would delete all keys that start with /foo/ in any other implementation.
Oh OK. Maybe I missed something in my setup, I’ll check again.
Thanks for the update though, interesting stuff in there!