MarketPress and redis caching exclusion

We have MarketPress running with redis. We are running into problems with the cart not returning the correct product. This is true with the cart page and the mini cart display. We have added the cache exclusion for the objects referenced in the MarketPress documents (PHPSESSID
mp_globalcart_*), but this did not resolve the problem. We are only getting errors on the cart objects so far. Is there another object that we can add to the exclusion list that may resolve this issue. Support on our site is currently open, and redis is still enabled. You can test this by trying to purchase something. The first item may work ( sometimes the first product shows in the cart correctly, but if you add multiple items you will see the issue). I have tried this on multiple servers on different host and have had the same result on all occasions.

  • Adam Czajczyk

    Hello Bryant,

    I hope you're well today and thank you for your question!

    I checked your site and, unless I'm missing something, that I didn't experience any issues while testing that as a logged in admin user while the cart didn't function as expected when used as a visitor.

    Redis is a server side cache and since you already excluded objects referenced by the docs that should be fine. There's however a Commet Cache installed on your site too and it sometimes can be very aggressive/persistent. The fact that cart seemed to work fine for me as a logged in admin user but not as a visitor suggests that this could be the issue. Commet Cache shouldn't be caching any data for admin user.

    That being said, could you please disable Comet Cache temporarily, then clear browser cache and see if the cart works fine for visitors then? It should either confirm or deny my assumption and so that would help me investigate that further.

    Let me know about result, please.

    Kind regards,

  • Bryant

    Good day,

    We are facing this issue for logged-in and logged-out use, even with comet cache disabled. We had already tried disabling comet cache, the issue still persist.

    Here is the steps to recreate this issue (Redis is currently Enabled and comet cache is off).
    1) Go this link:
    2) Click any product on the page
    3) Go to the bottom of the page
    4) Select a term and level and click but
    5) Is the product on the cart page the same product w/ term and level you selected?

    6) Repeat steps 1-5 but for a different product and term and level (must do to get the full scope of the issue)

    7) Remove all items from the cart
    8) go to another page and then click the menu and go back to the cart
    9) Their may be products in the cart again.
    10)go to dashboard --> Settings --> Redis
    11) Click show diagnostics information to confirm that the MarketPress cookies are disabled.
    12) Flush the redis cache by clicking flush
    13) Disable cache by clicking disable (Important: You may be logged out after disabling redis and may have to log back in.)
    14) Go back to the front of the site. Clear history
    15) Repeat steps 1-5 again. Everything should work fine even if you turn on comet cache.

    Notes: This issue is also effecting the mini cart. Where the object being returned is not correct. I tried this with two different redis plugins with the same result.

    When you try these steps you will see why we believe there may be another cached object that must be included.

  • Adam Czajczyk

    Hello Bryant!

    Thank you for your replay.

    I was testing that in a bit different way but following the steps that you described seem to confirm that it's Redis cache. Currently on your site:

    - Redis is enabled
    - Browser caching in Hummingbird is disabled (though browser caching "in general" is enabled anyway because you are using CloudFlare, so you can leave it the way it is or enable in Hummingbard again - that shouldn't make much different)
    - Comet Cache is set to be disabled.

    Flushing and disabling Redis seems to solve the case. I don't think however that any other cookies/sessions need to be excluded. I tested MarketPress a bit and it seems that these are the only ones that are used so I"m wondering whether they are really excluded. I mean, I can see that they are added to WP Ignored Groups but I'm not quite sure how that works. I tried to find some more information on how the plugin that you are using handles Redis but neither its description nor forum are particularly helpful :slight_smile:

    I'm wondering though whether this is a proper path in case of Redis. It's supposes to handle object cache so we might need to address WP transient rather than cookies. The only transient keys that I was able to find in plugin's code though (I admit I might be missing something) are all starting with "mp_order_". The "mp_order_history_" seems to be already added to your Redis "ignored" groups so I think it would be worth to also add just "mp_order_".

    These keys are starting with that string but then they are dynamically created and may e.g. contain order number and some other strings so it would be difficult to exclude them specifically. I'm not sure if the plugin that you are using allows such kind of "wild-card" names like just "mp_order_" but I'd try adding this.

    Can you please do it and see if that changes anything? Please run your tests with Comet Cache disabled, preferably even set the CloudFlare to "dev" mode so it would be bypassed during tests so we new for sure that nothing is interfering.

    If that doesn't help, I'll need to call developers for help.

    Best regards,

  • Bryant

    No, Didn't change. We tried adding mp_order_ and this did not change the issue. We also tried a different plugin for redis and had the same result. The other (referenced in our opening statement) plugin includes transient caching as well and it did not fix the issue.

    The importance of this particular setup is that we are running multiple servers. While it is not common, we have had rare cases of left brain right brain issues. For example some times we will have a users session switch servers during something that requires a wp nonce and their session switches and they will then have an invalid nonce. Or, if a session switches servers during a transaction then their order can disappear or have errors. This is extremely rare as we have session persistence setup but some times stuff happens.

    With redis these objects are not stored on the server, so if a users session does switch to a different server the object will still be available. Plus the speed boost.

  • Bryant

    Sorry for the late response. We had a lot going on today. I forgot to uncomment the ignore groups in the wp-config before you tested redis again. I did uncomment it and you can see it now. But Adam can confirm and you can see it in his last message that it these items where ignored. I added the other items you said to and it did not work. I also tried them with a mp_ in front just to be safe. Neither worked.

    I left the ignored groups uncommitted but disabled the redis plugin and I am leaving support open so you can see it.

    Are you guys using redis and marketpress? If so what did you use to connect to wordpress and how?

    Thanks for your help

  • Predrag Dubajic

    Hi Bryant,

    Yes, I can see the rules now and I repeated your steps once again, I was actually unable to replicate the issue with products still showing on checkout page after removing them but one product did still stay in floating cart.

    I must say that I'm not much familiar with Redis cache and the info above is something I was able to find as a possible solution, sorry to hear it doesn't work for you :slight_frown:

    I will need to forward this thread to our second live support develops and hopefully they will have some further info about this.
    Please note that, developer response might be slower than usual staff response, so we appreciate your patience on this.

    Best regards,

  • Ivan

    Hello Bryant !

    I tested 'Redis Object Cache' plugin on my test site and it works fine with MarketPress.
    I noticed that your site has this comment in code Comet Cache is Fully Functional and if you add some new GET parameter to your URL, for example, - you will see the page without cache.
    It seems it happens because you use Cloudflare service and I hope this problem go away after excluding these pages from CloudFlare.

    Please let me know how it goes.

    Best regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.