We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33983 ☆ A M B ☆
    • 181 Posts
    I have written an extra (plugin) for MODX Revo: https://github.com/jgulledge19/SuperCache, with the goal to reduce processing for pages that don't require a lot of user interaction. The idea is basically capture what Revo outputs to browser and then cache this and serve it back without any template/content processing, except if there are values in $_POST for forms or if $_GET has more then one key=>value pair.

    I am running the plugin on my site and here are my results from my test box:
    Response was 450 to 600 milliseconds and now with supercache enabled it is 60 to 100 milliseconds. Note 1000 milliseconds is 1 second.

    Here is the plugin code for you to try out: https://github.com/jgulledge19/SuperCache/blob/master/core/components/supercache/elements/plugins/plugin.supercache.php

    And the readme file: https://github.com/jgulledge19/SuperCache/tree/master/core/components/supercache/docs.

    You will need to add the following System Events:

    • OnLoadWebDocument
    • OnWebPagePrerender
    • OnDocFormSave
      • 39603
      • 3 Posts
      Hi, besides installing it via Package Management, is there anything else to do? Is adding those Systems Events still needed? How exactly do you do it? Thanks!
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        While I cannot say exactly how this plugin gets installed, you can edit any plugin and it will have a "System Events" tab with checkboxes for all of the registered system events. If you need to add any events to a plugin, just check their boxes and save the plugin.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 22840
          • 1,572 Posts
          Just tried installing this and get the following errors:

          Error 42S22 executing statement: Array ( [0] => 42S22 [1] => 1054 [2] => Unknown column 'modPluginEvent.name' in 'where clause' )
          Error 42S22 executing statement: Array ( [0] => 42S22 [1] => 1054 [2] => Unknown column 'modPluginEvent.name' in 'where clause' )
          Error 23000 executing statement: INSERT INTO `modx_site_plugin_events` (`pluginid`, `event`, `priority`, `propertyset`) VALUES (7, '', 0, 0) Array ( [0] => 23000 [1] => 1062 [2] => Duplicate entry '7-' for key 'PRIMARY' )
          Error saving vehicle object of class modPluginEvent; criteria: Array ( [name] => )
          Error 42S22 executing statement: Array ( [0] => 42S22 [1] => 1054 [2] => Unknown column 'modPluginEvent.name' in 'where clause' )
          Error 23000 executing statement: INSERT INTO `modx_site_plugin_events` (`pluginid`, `event`, `priority`, `propertyset`) VALUES (7, '', 0, 0) Array ( [0] => 23000 [1] => 1062 [2] => Duplicate entry '7-' for key 'PRIMARY' )
          Error saving vehicle object of class modPluginEvent; criteria: Array ( [name] => )
          Could not install related objects with locally owned keys for vehicle object of class modPlugin; criteria: Array ( [name] => SuperCache )


          It then says it's installed and the 3 events are ticked but there's no difference in page load time at all.

          Any pointers ?

          Thanks
            • 39603
            • 3 Posts
            Thanks a lot Susan, those system events were already checked, with priority 0, so that means it gets done with the package installation.

            I'm also experiencing no apparent difference in page load time, but maybe that's because it says that the plugin works for medium and large sites, and mine is a small one.
              • 22656
              • 121 Posts
              you have to go to settings and enter ids of the pages you want cached.
              I have seen massive improvements in speed.
                • 22840
                • 1,572 Posts
                According to the include resources in the settings it's a comma seperated list, however it states at the end "If you use this all other resources will be excluded", I understand that as it is on all pages unless you specify any there and then everything else will be excluded ?

                Cheers
                  • 22656
                  • 121 Posts
                  mmm, however I could only see caching improvements on my homepage once I have actually specified the id, with 0 in there looked like nothing got cached... [ed. note: papachumba last edited this post 14 years, 2 months ago.]
                    • 22840
                    • 1,572 Posts
                    Well I've just tested this with my home page and the results are not good, when setting 1 in the include resources ( my home page ) its gone from 0.456 ( without specifying a page ) to 1.890 ( first load ) to 1,746 ( second load ), specifying 0 in the setting it goes back down to 0.685 on first load and 0.524 on second
                      • 33983 ☆ A M B ☆
                      • 181 Posts
                      I thought I put more docs out there but I did not see them so I must not have. I will try put some docs up soon.

                      @davdivm - no it should work on install but it only works when you are not logged in. So try it on a different browser or log out and do a couple of page loads to see what happens.

                      @papachumba & @Paulp - by default it includes all pages. Once you include a page it then excludes all other pages.

                      @Paulp - not sure about your install error but it looks like you got it to work correct?

                      If you want to verify that it is working go to /your-modx-path/core/cache/default/ and you should see the files like supercache_1.cache.php. The number represents that resource ID. Note I may change the cache path for future versions.