phprs\util\IoCContainer::callThroughCache PHP Method

callThroughCache() public method

public callThroughCache ( $method, $arguments )
    public function callThroughCache($method, $arguments)
    {
        $op = $this->getCacheOptions($method);
        if ($op) {
            $got = false;
            $key = $this->genKey($method, $arguments);
            $res = $this->cache->get($key, $got);
            if ($got) {
                return $res;
            } else {
                /*static $methods = [];
                  $name = $this->factory->getClassName($this->id).'::'.$method;
                  if(!array_key_exists($name, $methods)){
                      $refl = new \ReflectionClass($this->factory->getClassName($this->id));
                      $methods[$name] = $refl->getMethod($method);
                  }
                  $res = $methods[$name]->invokeArgs($this->getObj(), $arguments);
                  */
                $res = call_user_func_array([$this->getObj(), $method], $arguments);
                $this->cache->set($key, $res, $op['ttl'], isset($op['checker']) ? $op['checker'] : null);
                return $res;
            }
        } else {
            return call_user_func_array([$this->getObj(), $method], $arguments);
        }
    }