matthiasmullie/scrapbook

Redis wrong default value

nsn0x01 opened this issue · 1 comments

I'm using Redis adapter with SimpleCache implementation and I guess there is a bug here.

$testStore = new SimpleCache(new Redis($client)); var_dump($testStore->get('missedKey'));

For the key missed I'm expecting the $default value defined by this method.

`
public function get($key, $default = null)
{
$this->assertValidKey($key);

    // KeyValueStore::get returns false for cache misses (which could also
    // be confused for a `false` value), so we'll check existence with getMulti
    $multi = $this->store->getMulti(array($key));

    return isset($multi[$key]) ? $multi[$key] : $default;
}

`

The result for the key missed is instead the boolean "false" when the default is "null".

This was fixed with 31f4578