Cachearium\CacheAbstract::getMulti PHP Method

getMulti() public method

Backends may override this to provide an efficient implementation over multiple calls to get().
public getMulti ( array $cacheid, callable $callback = null ) : array:mixed
$cacheid array List of cache keys
$callback callable if present will be called for any \NotCachedExceptions. Callback should have this signature: (CacheAbstract $c, CacheKey $k)
return array:mixed
    public function getMulti(array $cacheid, $callback = null)
    {
        $retval = [];
        foreach ($cacheid as $k => $c) {
            try {
                $retval[$k] = $this->get($c);
            } catch (Exceptions\NotCachedException $e) {
                // if there is a callback, call it
                if ($callback) {
                    $retval[$k] = call_user_func($callback, $this, $c);
                }
            }
        }
        return $retval;
    }