How to disable updation of session expire time in every page load?

I have used writeCallback to add extra data with session. Now I can see that expire time is updated for session in every page load.

here is snippet from my main.php file:




'session' => [

		    'class' => 'yii\web\DbSession',

		    'sessionTable' => '{{%sessions}}',

		    'timeout' => 3600*24*30,

		    'writeCallback'=>function($session) {

			    return [

				    'user_id' => Yii::$app->user->id,

			    ];

		    }

	    ],

Suggest me how this can be disabled?

Do it once in login action, for example


\Yii::$app->controller->id

is NULL so can’t check with controller name and action name. Can you give example of what you are trying to explain?