Hello Everyone.
I got this Plugin that is writing in a setting a random number for the Etag in the website headers.
The idea is to modify the number every time the user save a chunk, snippet, template, TV.
With this what I’m trying to do is to tell the browsers reload a fresh version of every resource is opened (avoid cache) without needed to clear cache every single time changes are set.
Setting: etag
eTagHash Plugin: OnCacheUpdate, OnChunkSave, OnPluginSave, OnSnippetSave, OnTemplateSave, OnTemplateVarSave
The Code:
<?php
$value = mt_rand(10000000,99999999);
$setting = $modx->getObject('modSystemSetting', 'etag');
$setting->set('value', $value);
$setting->save();
The problem: This is working so far so good, the problem is that it’s triggered when a resource is saved too, I don’t understand the reason so any help to avoid this will be welcome.
Thanks you very much!