Skip to content

Commit

Permalink
Update memcached
Browse files Browse the repository at this point in the history
  • Loading branch information
ve3 committed Jun 20, 2019
1 parent d12d383 commit a061f48
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ $SimpleCache = new \Rundiz\SimpleCache\Drivers\Apcu();
$SimpleCache = new \Rundiz\SimpleCache\Drivers\FileSystem();
```

Common methods to get, set, delete, or anything else please read more at [PSR-16 doc.](https://www.php-fig.org/psr/psr-16/).<br>
Common methods to get, set, delete, or anything else please read more at [PSR-16 document](https://www.php-fig.org/psr/psr-16/).<br>
Here are few examples.

```php
Expand Down
10 changes: 5 additions & 5 deletions src/Drivers/Memcached.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ public function get($key, $default = null)
throw new InvalidArgumentException('$key must be a string');
}

$flags = false;
$value = $this->Memcached->get($key, $flags);
if ($flags !== false) {
return $value;
$result = $this->Memcached->get($key);
if ($result === false && $this->Memcached->getResultCode() === \Memcached::RES_NOTFOUND) {
return $default;
}
return $default;

return $result;
}// get


Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/MemcachedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ public function setup()
}

$Memcached = new \Memcached;
$Memcached->connect('localhost', 11211) or die ("Could not connect");
$Memcached->addServer('localhost', 11211) or die ("Could not connect");
$this->SimpleCache = new \Rundiz\SimpleCache\Drivers\Memcached($Memcached);
}// setup


public function tearDown()
{
$this->SimpleCache->clear();
$this->SimpleCache->getMemcached()->close();
$this->SimpleCache->getMemcached()->quit();
}// tearDown


Expand Down
2 changes: 1 addition & 1 deletion tests/via-http/memcached.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


$Memcached = new \Memcached;
$Memcached->connect('localhost', 11211) or die ("Could not connect");
$Memcached->addServer('localhost', 11211) or die ("Could not connect");
$SimpleCache = new Rundiz\SimpleCache\Drivers\Memcached($Memcached);

if (isset($_GET['act']) && $_GET['act'] === 'clear') {
Expand Down

0 comments on commit a061f48

Please sign in to comment.