ForgeTotal.js 5
en

Total.js 5

Invalidate release-mode static caches with TOUCH

Total.js 5 · total5@0.0.19 total5reference Executed against Total.js 5

TOUCH(url) clears three cache entries for that URL: F.temporary.minified, tmp and notfound. TOUCH() clears those maps. It does not clear CACHE, NoSQL documents or every view/configuration cache. Call it after changing a generated asset in release mode. Keep this operation in trusted server code; the write endpoint below is only a local fixture.

Cache invalidation applies to the running process. When an application runs in several processes, coordinate invalidation across those processes.

public/generated.txt
before
controllers/assets.js
exports.install = function() {
	ROUTE('POST /regenerate/', function($) {
		F.Fs.writeFileSync(PATH.public('generated.txt'), 'after');
		F.Fs.writeFileSync(PATH.public('appeared.txt'), 'created');
		TOUCH('/generated.txt');
		TOUCH('/appeared.txt');
		$.success();
	});
};