UrlManger cache consumes MBs of storage

Hi,
we have two Yii2 applications, lets say app A and app B. In both of them we have a component ‘cache’ (\yii\caching\FileCache::class).
In both applications we have a component ‘urlManager’ configured like this:
‘class’ => UrlManager::class,
‘enablePrettyUrl’ => true,
‘enableStrictParsing’ => true,
‘showScriptName’ => false,
‘rules’ => $routes

The $routes is an array with different routes, defined in different flavors like (changed as I can’t show the actual routes):
‘GET /monitoring/info/modules’ => ‘monitoring/modinfo/get-mods’,
[
‘verb’ => ‘GET’,
‘pattern’ => '/user/history,
‘route’ => ‘userhistory/default/list’,
],
[
‘class’ => ‘yii\web\GroupUrlRule’,
‘prefix’ => ‘admin’,
‘rules’ => […],
]

only in the problem causing app B we are also using this flavor:
[
‘class’ => yii\rest\UrlRule::class,
‘controller’ => [‘numbers’ => ‘specialnumbers/numbers-summary’],
‘prefix’ => ‘user//’,
‘except’ => [‘options’, ‘patch’, ‘head’, ‘put’, ‘post’],
],

Both are running, but app B is creating new cache entries time an URL is call, even its the same URL like pressing refresh in the browser.

As far as I could see the files created in the cache folder have the same content.

Both apps are running on VMs configured identically, in terms of OS, PHP version and modules. And app A uses Yii version 2.0.38 and app B uses Yii version 2.0.37.

Does anyone experienced this kind of behavior too?
Any suggestions?

Thanks in advance.

What are cache keys?

In the working app A I can see something like that at the begin of the cache file:

    a:2:{
        i:0;a:43:{i:0;O:15:"yii\web\UrlRule":16:{
            s:4:"name";
            s:4:"info";
            s:7:"pattern";
            s:9:"#^info$#u";
            s:4:"host";N;
            s:5:"route";
            s:8:"defaults";a:0:{}
            s:6:"suffix";N;
            s:4:"verb";N;
            s:4:"mode";N;
            s:12:"encodeParams";b:1;
            s:10:"normalizer";N;
            s:15:"*createStatus";N;
            s:15:"*placeholders";a:0:{}
            s:26:"yii\web\UrlRule_template";
            s:6:"/info/";        
            s:27:"yii\web\UrlRule_routeRule";N;
            s:28:"yii\web\UrlRule_paramRules";a:0:{}
            s:29:"yii\web\UrlRule_routeParams";a:0:{}
            }

In the app B I can see something like that at the begin of the cache file:

    a:2:{
        i:0;a:413:{
            i:0;O:15:"yii\web\UrlRule":16:{
                s:4:"name";
                s:60:"/attendee/<attendee#\w+>/exams/<limit:\d+>/<offset:\d+>";
                s:7:"pattern";
                s:87:"#^attendee/(?P<a81398e09>\w+)/exams(/(?P<a7f96e860>\d+))?(/(?P<a590acad0>\d+))?$#u";
                s:4:"host";N;
                s:5:"route";
                s:23:"exams/default/list";
                s:8:"defaults"; a:2:{
                    s:5:"limit";i:0;
                    s:6:"offset";i:0;
                    }
                s:6:"suffix";N;
                s:4:"verb";a:1:{
                    i:0;s:3:"GET";
                    }
                s:4:"mode";N;
                s:12:"encodeParams";b:1;
                s:10:"normalizer";N;
                s:15:"*createStatus";N;
                s:15:"*placeholders";a:3:{
                    s:9:"a81398e09";
                    s:8:"attendee";
                    s:9:"a7f96e860";
                    s:5:"limit";
                    s:9:"a590acad0";
                    s:6:"offset";
                    }
                s:26:"yii\web\UrlRule_template";
                s:49:"/attendee/<attendee>/exams/<limit>/<offset>/";
                s:27:"yii\web\UrlRule_routeRule";N;
                s:28:"yii\web\UrlRule_paramRules";a:3:{
                    s:8:"attendee";
                    s:8:"#^\w+$#u";
                    s:5:"limit";
                    s:8:"#^\d+$#u";
                    s:6:"offset";
                    s:8:"#^\d+$#u";
                    }
                s:29:"yii\web\UrlRule_routeParams";a:0:{}
            }        

Was it that what you wanted to know?
An I had to correct myself app A is running on Yii 2.0.38, maybe there was a bugfix or change, I will have a look at it.

Yeah. That’s what I was going to take a look at but it gave no clue.