We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9710
    • 24 Posts
    Hi,

    In the system settings (revo 2.0.8pl) you are able to replace the cache handler (xPDOFileCache) with your own. I want to use memcached as default cache system. The Problem is that I simply don’t know where to place my class for integration so that modx can find it without hacking the core.

    I saw there is another thread about using memcached here but it seems to me only useful if you want to store some of your own objects in a snippet or plugin. You create your own cachemanager for handling your own cache, but it doesn’t replace the general cache - or am I wrong?

    Has anyone ever tried using another caching system?
      • 22303 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.
        • 9710
        • 24 Posts
        Quote from: OpenGeek at Mar 15, 2011, 09:14 AM

        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.
        Good to know, thanks


        Quote from: OpenGeek at Mar 15, 2011, 09:14 AM

        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.
        Sounds nice.. When can we expect to get the 2.1 release? smiley
          • 22303 MODX Staff
          • 10,725 Posts
          Quote from: Firebird at Mar 17, 2011, 02:07 PM

          Sounds nice.. When can we expect to get the 2.1 release? smiley
          We should have an RC in the next few weeks.
            • 34665
            • 11 Posts
            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
              • 22303 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.
                • 34665
                • 11 Posts
                Oh OK. Maybe I missed something in my setup, I’ll check again.

                Thanks for the update though, interesting stuff in there!