From 962f975a6f5b0e4ed604d5b8c59d5dfca3f05e98 Mon Sep 17 00:00:00 2001 From: Till Klampaeckel Date: Mon, 16 Apr 2012 23:22:18 +0300 Subject: [PATCH] Use Memcache::replace() first instead of Memcache::set(): http://docs.php.net/manual/en/memcache.replace.php#100023 --- .../Session/Storage/Handler/MemcacheSessionHandler.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php index 00488fd0d9..fe29832f70 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php @@ -117,7 +117,10 @@ class MemcacheSessionHandler implements \SessionHandlerInterface */ public function write($sessionId, $data) { - return $this->memcache->set($this->prefix.$sessionId, $data, 0, $this->memcacheOptions['expiretime']); + if (!$this->memcache->replace($this->prefix.$sessionId, $data, 0, $this->memcacheOptions['expiretime'])) { + return $this->memcache->set($this->prefix.$sessionId, $data, 0, $this->memcacheOptions['expiretime']); + } + return true; } /**