需要刷新的Magento会话文件存储

I've moved stores to a new server that doesn't support memcache, I've fallen back to writing to the file system. When a user is visiting for the first time and puts an item in the cart nothing happens, it redirects them to the cart page which states no items added.

Next time the user tries adding a product into the cart it will be visible but sometimes needing a refresh in order to see it. Same happens with removing an item from the cart, mini cart does reflect in real time. Seems like an issue with the write process not completing before being read?

The var/sessions folder has 0777 for the purpose of testing.

Is this a common issue?

Have the following for file storage

<session_save><![CDATA[files]]></session_save>
<session_cache_limiter><![CDATA[]]></session_cache_limiter>

When previously using memcache it looked like

<session_save><![CDATA[memcache]]></session_save>
<session_save_path><![CDATA[unix:///var/tmp/memcached.sess.newdomain.co.nz_sessions.sock?persistent=1&weight=2&timeout=10&retry_interval=10]]></session_save_path>
<session_cache_limiter><![CDATA[]]></session_cache_limiter>

So after debugging every single cache possible it actually turned out to be browser caching the site, this was happening for everybody that visited the site, why I still have no idea.

I added the following in .htaccess which seems to have resolved the issue

<FilesMatch "\.(html|htm|js|css|php)>
    FileETag None
    Header unset ETag
    Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
    Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</FilesMatch>

Sounds like you need a bit more research before you'll be able to get an answer here. The behavior you describe sounds more like a varnish, or full page caching issue. Until you know exactly what's happening, the folks here, or at the Magento Stack Exchange, will be left guessing as to what the real problem is, and its unlikely they'll be able to help.

Specifically, I'd look for

  • Changing session IDs in the frontend while you're browsing.
  • Incorrect form keys that block items being added to the cart
  • Examine the actual session files to see if cart items have been added to the session you think they should be added to

Once you have a better understanding of the mechanics of the problem, other programmers here will be likely able to help you (or, you may be able to help yourself)

Good luck!