Skip to content

Commit

Permalink
Use Memcache::replace() first instead of Memcache::set(): http://docs…
Browse files Browse the repository at this point in the history
  • Loading branch information
till authored and fabpot committed Apr 18, 2012
1 parent a47a5aa commit 962f975
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ public function read($sessionId)
*/
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;
}

/**
Expand Down

0 comments on commit 962f975

Please sign in to comment.