10000 Use Memcache::replace() first instead of Memcache::set(): http://docs… · symfony/symfony@962f975 · GitHub
[go: up one dir, main page]

Skip to content

Commit 962f975

Browse files
tillfabpot
authored andcommitted
Use Memcache::replace() first instead of Memcache::set(): http://docs.php.net/manual/en/memcache.replace.php#100023
1 parent a47a5aa commit 962f975

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ public function read($sessionId)
117117
*/
118118
public function write($sessionId, $data)
119119
{
120-
return $this->memcache->set($this->prefix.$sessionId, $data, 0, $this->memcacheOptions['expiretime']);
120+
if (!$this->memcache->replace($this->prefix.$sessionId, $data, 0, $this->memcacheOptions['expiretime'])) {
121+
return $this->memcache->set($this->prefix.$sessionId, $data, 0, $this->memcacheOptions['expiretime']);
122+
}
123+
return true;
121124
}
122125

123126
/**

0 commit comments

Comments
 (0)
0