protected function dumpRoutesCache(): int
    {
        if (!$file = $this->cacheFile) {
            return 0;
        }

        if ($this->isCacheEnable() && \file_exists($file)) {
            return 1;
        }

        $date = \date('Y-m-d H:i:s');
        $class = static::class;
        $count = $this->count();

        $staticRoutes = \var_export($this->staticRoutes, true);
        $regularRoutes = \var_export($this->regularRoutes, true);
        $vagueRoutes = \var_export($this->vagueRoutes, true);

        $code = <<<EOF
<?php
/*
 * This is routes cache file of the package `inhere/sroute`.
 * It is auto generate by $class.
 * @date $date
 * @count $count
 * @notice Please don't edit it.
 */
return array (
// static routes
'staticRoutes' => $staticRoutes,
// regular routes
'regularRoutes' => $regularRoutes,
// vague routes
'vagueRoutes' => $vagueRoutes,
);\n
EOF;
        return \file_put_contents($file, \preg_replace(
            ['/\s+\n\s+Inhere\\\\Route\\\\Route::__set_state\(/', '/\)\),/', '/=>\s+\n\s+array \(/'],
            [' ', '),', '=> array ('],
            $code
        ));
    }