Fixed issue with pulling multiple keys

Namespace / uppercasing the key wasn't taking into consideration that sometimes array's can be present.
This commit is contained in:
Josh Sherman 2012-10-23 23:55:57 -04:00
parent 99aa78b6fa
commit 8e7a8f15c7
2 changed files with 32 additions and 8 deletions

View file

@ -150,14 +150,26 @@ class Cache extends Object
* *
* Gets the value of the key and returns it. * Gets the value of the key and returns it.
* *
* @param string $key key to retrieve * @param mixed $keys key(s) to retrieve
* @return mixed value of the requested key, false if not set * @return mixed value(s) of the requested key(s), false if not set
*/ */
public function get($key) public function get($keys)
{ {
if ($this->open()) if ($this->open())
{ {
return $this->connection->get(strtoupper($this->namespace . $key)); if (is_array($keys))
{
foreach ($keys as $index => $key)
{
$keys[$index] = strtoupper($this->namespace . $key);
}
}
else
{
$keys = strtoupper($this->namespace . $keys);
}
return $this->connection->get($keys);
} }
return false; return false;

20
jar.php
View file

@ -583,14 +583,26 @@ class Cache extends Object
* *
* Gets the value of the key and returns it. * Gets the value of the key and returns it.
* *
* @param string $key key to retrieve * @param mixed $keys key(s) to retrieve
* @return mixed value of the requested key, false if not set * @return mixed value(s) of the requested key(s), false if not set
*/ */
public function get($key) public function get($keys)
{ {
if ($this->open()) if ($this->open())
{ {
return $this->connection->get(strtoupper($this->namespace . $key)); if (is_array($keys))
{
foreach ($keys as $index => $key)
{
$keys[$index] = strtoupper($this->namespace . $key);
}
}
else
{
$keys = strtoupper($this->namespace . $keys);
}
return $this->connection->get($keys);
} }
return false; return false;