Clear all cached items for a class + method or class

@param  string|object $class  The namespace class or object used to identify the cached item
@param  string        $method The method used to identify the cached item
@return bool
345694
public function clear($class, $method)
    {
        // we know which one we're clearing
        if ($method) {
            $this->redis->del($class.':'.$method);

            return true;
        } else {
            // they want to clear the whole class so we have to get a method list
            $methods = $this->redis->hkeys('method_list:'.$class);

            // delete the method from the list of cached methods and clear the cache items
            $this->redis->pipeline(function($pipe) use ($class, $methods) {

                $pipe->del('method_list:'.$class);

                foreach ($methods as $method) {
                    $pipe->del($class.':'.$method);
                }
            });

            return true;
        }
    }
853146
protected function hasBinding($class)
    {
        if ($this->isCollection($class) && ! $class->isEmpty()) {
            $class = $class->first();
        }

        $class = is_object($class) ? get_class($class) : $class;

        return isset($this->bindings[$class]);
    }
211900
public function removeClass($class)
    {
        $index = array_search((string) $class, $this->class);
        if ($index !== false) {
            unset($this->class[$index]);
        }
        return $this;
    }
619224
public function isStaticClassMethod(ClassMethod $classMethod): bool
    {
        return (bool) $this->betterNodeFinder->findFirst((array) $classMethod->stmts, function (Node $node) {
            if (! $node instanceof Variable) {
                return false;
            }

            return $this->nameResolver->isName($node, 'this');
        });
    }
1045466
protected function storeCacheKeys($class, $method, $hash)
    {
        $keysFile  = $this->getContainer('config')->get('rinvex.repository.cache.keys_file');
        $cacheKeys = $this->getCacheKeys($keysFile);

        if (! isset($cacheKeys[$class]) || ! in_array($method.'.'.$hash, $cacheKeys[$class])) {
            $cacheKeys[$class][] = $method.'.'.$hash;
            file_put_contents($keysFile, json_encode($cacheKeys));
        }
    }
1194579
public function remove_class( $class ) {
		if ( !isset( $this->attr['class'] ) || !is_array( $this->attr['class'] ) ) {
			$this->_sanitize_class();
		}
		$this->attr['class'] = array_diff( $this->attr['class'], array( $class ) );
		return $this;
	}
1229302
final public static function clearInstance($className)
  {
    if (isset(self::$_instances[$className])) {
      $name = self::_configName($className);
      Config::clearInstance($name);

      self::$_instances[$className]->_loadObservers();
    }
  }
1300126
protected function cacheCallback($class, $method, $args, Closure $closure)
    {
        $repositoryId = $this->getRepositoryId();
        $lifetime     = $this->getCacheLifetime();
        $hash         = $this->generateCacheHash($args);
        $cacheKey     = $class.'@'.$method.'.'.$hash;

        // Switch cache driver on runtime
        if ($driver = $this->getCacheDriver()) {
            $this->getContainer('cache')->setDefaultDriver($driver);
        }

        // We need cache tags, check if default driver supports it
        if (method_exists($this->getContainer('cache')->getStore(), 'tags')) {
            $result = $lifetime === -1
                ? $this->getContainer('cache')->tags($repositoryId)->rememberForever($cacheKey, $closure)
                : $this->getContainer('cache')->tags($repositoryId)->remember($cacheKey, $lifetime, $closure);

            // We're done, let's clean up!
            $this->resetRepository();

            return $result;
        }

        // Default cache driver doesn't support tags, let's do it manually
        $this->storeCacheKeys($class, $method, $hash);

        $result = $lifetime === -1
            ? $this->getContainer('cache')->rememberForever($cacheKey, $closure)
            : $this->getContainer('cache')->remember($cacheKey, $lifetime, $closure);

        // We're done, let's clean up!
        $this->resetCachedRepository();

        return $result;
    }
884586
protected function clearNamespace(string $class)
    {
        if (file_exists($class)) {
            $content = file_get_contents($class);
            $content = preg_replace('#^namespace\s+(.+?);$#sm', ' ', $content);
            file_put_contents($class, $content);
        }
    }
11015
public function clearMethods() {
		foreach ($this->methods as $method) {
			$method->setParent(null);
		}
		$this->methods->clear();

		return $this;
	}
1015848
public void clear(ClassLoader cl) {
	Page page = this.page;
	if (page != null && page.getClass().getClassLoader().equals(cl)) {
	    this.page = null;
	}
    }
823003
static function getMethodAnnotations($method, $class = NULL)
	{
		$method instanceof ReflectionMethod or $method = new ReflectionMethod($class, $method);

		return static::instance()->getMethodAnnotations($method);
	}
792833
public function removeClass($className)
  {
    $pos = array_search($className, $this->classes);
    if (is_numeric($pos)) {
      unset($this->classes[$pos]);
      return true;
    }
    return false;
  }
473611
public static function classHasMethod($method, $class) {
        $methods = self::classMethods($class);

        if (!in_array($method, $methods)) {
          return false;
        }

        return true;
    }
743807
protected function getReflectionMethod($class, $method)
    {
        if (!isset($this->methodReflectors[$class])) {
            $this->methodReflectors[$class] = [];
        }
        if (!isset($this->methodReflectors[$class][$method])) {
            $this->methodReflectors[$class][$method] = new \ReflectionMethod($class, $method);
        }

        return $this->methodReflectors[$class][$method];
    }
515612
public function remove($class, array $id)
    {
        if (!$this->isEnabled()) {
            return false;
        }

        $key = self::key($class, $id);
        unset($this->members[$key]);
    }
1242693
public function disallowMethod($class, $method = null)
    {
        if (is_array($class)) {
            foreach ($class as $elem) {
                unset($this->allowedMethods[strtolower($elem[0])][strtolower($elem[1])]);
            }
        } else {
            unset($this->allowedMethods[strtolower($class)][strtolower($method)]);
        }
    }