public function invalidateCache()
    {
        if (!$this->isNewRecord) {
            $cache = Yii::$app->cache;
            if ($cache !== null) {
                $key = $this->getCacheKey();
                if ($key != null) {
                    Yii::debug(sprintf("Clear cache key %s", $key));
                    $cache->delete($key);
                }

                $tags = $this->getCacheTag();
                if ($tags !== null) {
                    TagDependency::invalidate($cache, $tags);
                }
            }
        }
    }