---
title: Worker, thread e cluster
project: Total.js V4
version: 0.0.99
section: reference
language: it
license: MIT
url: https://totaljs.es/docs/it/total-js-v4/0-0-99/reference/workers-and-threads/
updated: 2026-11-16T15:41:05.817Z
---

# Worker, thread e cluster

> NEWTHREAD(), NEWFORK(), NEWTHREADPOOL(), WORKER(), SHELL(), LOAD() e l'API del cluster.

Tutte le funzioni, le proprietà e le opzioni di avvio per worker in background, thread, comandi shell e cluster. La guida [Worker, thread e cluster](../../guides/workers-and-threads/) mostra come si combinano tra loro.

## API

### NEWTHREAD(name, [data])

Type: `method`

Esegue uno script da /workers/ come thread worker_threads.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | no |  | Il nome del file in `/workers/` senza `.js`, `@package` o `~/absolute/path.js`; omettilo all'interno di un worker per ottenere l'helper |
| `data` | `Object` | no |  | Dati per il thread (`workerData`) |

Returns: `Worker` Il thread, oppure l'helper del worker quando `name` è vuoto

Avvia `/workers/{name}.js` con `new Worker()` del modulo `worker_threads` di Node.js e restituisce il `Worker`. `data` arriva al thread come `workerData` (il `worker.data` dell'helper). L'oggetto restituito ha `kill()` ed `exit()`, che chiamano `terminate()`.

Un `name` che inizia con `@` punta a un file di un pacchetto, uno che inizia con `~` è un percorso assoluto. Senza `name`, la funzione restituisce l'helper lato worker (vedi `worker.data`, `worker.message`, `worker.send()`).

Example: Avviare un thread
```js
var worker = NEWTHREAD('hash', { rounds: 10 });
worker.on('message', function(msg) {
	console.log(msg);
	worker.kill();
});
worker.postMessage('secret');
```

### NEWFORK(name)

Type: `method`

Esegue uno script da /workers/ come processo figlio.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | no |  | Il nome del file in `/workers/` senza `.js`, `@package` o `~/absolute/path.js`; omettilo all'interno di un worker per ottenere l'helper |

Returns: `ChildProcess` Il processo figlio, oppure l'helper del worker quando `name` è vuoto

Avvia `/workers/{name}.js` con `child_process.fork()` nella directory dell'app e restituisce il `ChildProcess`. L'oggetto ha `postMessage()` (alias di `send()`) e `terminate()` (invia `SIGTERM`), quindi ha gli stessi metodi di un thread di `NEWTHREAD()`.

Le regole per il nome sono le stesse di `NEWTHREAD()`. Senza `name`, la funzione restituisce l'helper lato worker.

Example: Avviare un fork
```js
var fork = NEWFORK('import');
fork.on('message', function(msg) {
	console.log('Imported', msg.count);
	fork.terminate();
});
fork.postMessage({ filename: PATH.databases('import.csv') });
```

### NEWTHREADPOOL(name, count, [isfork])

Type: `method`

Avvia un numero fisso di worker e li presta ai job.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | yes |  | Il nome del file in `/workers/` senza `.js` |
| `count` | `Number` | yes |  | Quanti worker avviare |
| `isfork` | `Boolean` | no | `false` | Usa processi figli invece dei thread |

Returns: `Object` Il pool con `exec()`, `workers` e `pending`

Avvia `count` worker di `/workers/{name}.js` con `NEWTHREAD()`, oppure con `NEWFORK()` quando `isfork` è `true`, e restituisce un pool. I job si eseguono con `pool.exec()`. Il pool viene anche memorizzato in `F.workerspool[name]`.

Example: Un pool di quattro thread
```js
var pool = NEWTHREADPOOL('resize', 4);
```

Example: Un pool di processi figli
```js
var pool = NEWTHREADPOOL('pdf', 2, true);
```

### pool.exec([fn])

Type: `method`

Esegue un job sul prossimo worker libero di un pool.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `fn` | `Function` | no |  | `function(worker, release)` |

Returns: `Promise` Solo quando `fn` non è indicato; si risolve con il worker

Quando un worker è libero, il pool rimuove i suoi listener `message` e chiama `fn(worker, release)`; all'interno di `fn`, anche `this` è il worker. Chiama `release()` quando il job è terminato, così il worker può prendere il job successivo. I job attendono in `pool.pending` mentre tutti i worker sono occupati.

Senza `fn` il metodo restituisce una promise che si risolve con il worker libero. Chiama `worker.release()` quando hai finito.

Example: Con una callback
```js
pool.exec(function(worker, release) {
	worker.on('message', function(msg) {
		release();
		console.log(msg);
	});
	worker.postMessage({ id: 1 });
});
```

Example: Con await
```js
var worker = await pool.exec();
worker.on('message', function(msg) {
	worker.release();
	console.log(msg);
});
worker.postMessage({ id: 2 });
```

### pool.workers

Type: `property`

I worker di un pool.

Returns: `Array`

Un array degli oggetti `Worker` o `ChildProcess` avviati dal pool. `pool.pending` è l'array dei job che attendono un worker libero.

### F.workerspool

Type: `property`

I pool creati da NEWTHREADPOOL(), per nome.

Returns: `Object`

Un oggetto in cui ogni chiave è il `name` passato a `NEWTHREADPOOL()` e ogni valore è il pool. Usalo per ottenere un pool in un altro file.

Example: Usare un pool da un altro file
```js
F.workerspool.resize.exec(function(worker, release) {
	// ...
	release();
});
```

### worker.data

Type: `property`

I dati che il processo padre ha passato a NEWTHREAD().

Returns: `Object`

In un file worker, `NEWTHREAD()` o `NEWFORK()` senza argomenti restituisce l'helper del worker. `worker.data` è l'argomento `data` di `NEWTHREAD(name, data)`. In un processo figlio è un oggetto vuoto; invia invece i dati con un messaggio.

Example: In /workers/hash.js
```js
require('total4');
var worker = NEWTHREAD();
console.log(worker.data.rounds);
```

### worker.message = function(msg) {}

Type: `delegate`

Riceve i messaggi che il processo padre invia al worker.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `msg` | `Object` | yes |  | Il messaggio del processo padre |

Assegna una funzione all'helper restituito da `NEWTHREAD()` o `NEWFORK()` senza argomenti. Viene chiamata per ogni messaggio del processo padre, sia in un thread sia in un processo figlio.

Example: Rispondere a ogni messaggio
```js
require('total4');
var worker = NEWFORK();
worker.message = function(msg) {
	worker.send({ id: msg.id, length: msg.text.length });
};
```

### worker.send(message)

Type: `method`

Invia un messaggio dal worker al processo padre.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `message` | `Object` | yes |  | Un valore serializzabile |

Usa `parentPort.postMessage()` in un thread e `process.send()` in un processo figlio. `worker.postMessage()` è lo stesso metodo. Il processo padre riceve il messaggio in `on('message')` dell'oggetto restituito da `NEWTHREAD()` o `NEWFORK()`.

Example: Comunicare l'avanzamento
```js
worker.send({ progress: 50 });
```

### worker.exit([code])

Type: `method`

Termina il worker.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `code` | `Number` | no | `0` | Il codice di uscita |

Chiama `process.exit(code)`. `worker.kill()` e `worker.close()` sono lo stesso metodo.

Example: Terminare dopo la risposta
```js
worker.message = function(msg) {
	worker.send(msg);
	worker.exit();
};
```

### worker.setTimeout(timeout)

Type: `method`

Termina il worker dopo un limite di tempo.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `timeout` | `Number` | yes |  | Millisecondi |

Avvia un timer che termina il worker con codice di uscita `1` dopo `timeout` millisecondi. Una nuova chiamata sostituisce il timer precedente, quindi puoi richiamarlo per estendere il limite mentre il worker è occupato.

Example: Limitare il worker a un minuto
```js
var worker = NEWTHREAD();
worker.setTimeout(60000);
```

### WORKER(name, [timeout], [args])

Type: `method`

Esegue il fork di uno script da /workers/ (la vecchia API).

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | yes |  | Il nome del file in `/workers/`, senza `.js` |
| `timeout` | `Number` | no |  | Termina il processo dopo questo numero di millisecondi |
| `args` | `Array` | no |  | Argomenti da riga di comando per lo script |

Returns: `ChildProcess`

Esegue `/workers/{name}.js` con `child_process.fork()` nella directory dell'app e restituisce il `ChildProcess`. Gli argomenti `args` e `--worker` vengono passati allo script. Il processo è memorizzato in `F.workers` finché non termina. Quando scade `timeout` (più di 10 ms), il processo viene terminato con `SIGKILL`.

`timeout` può essere omesso: `WORKER(name, args)`. Un nome che inizia con `@` punta a un file di un pacchetto; un nome che inizia con `#` restituisce un worker in esecuzione da `F.workers` tramite il suo id. `NEWFORK()` è l'alternativa più recente.

Example: Eseguire un worker per al massimo 10 secondi
```js
var worker = WORKER('stats', 10000);
worker.on('message', function(msg) {
	console.log(msg);
});
worker.send({ year: 2024 });
```

Example: /workers/stats.js
```js
require('total4');
process.on('message', function(msg) {
	process.send({ year: msg.year, count: 0 });
	process.exit(0);
});
```

### WORKER2(name, [args], callback, [timeout])

Type: `method`

Esegue uno script da /workers/ e restituisce il suo standard output.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | yes |  | Il nome del file in `/workers/`, senza `.js` |
| `args` | `Array` | no |  | Argomenti da riga di comando; lo script li legge da `process.argv` |
| `callback` | `Function` | yes |  | `function(err, buffer)` |
| `timeout` | `Number` | no |  | Termina il processo dopo questo numero di millisecondi |

Returns: `ChildProcess`

Esegue il fork di `/workers/{name}.js` in modo silenzioso (come `WORKER()`), raccoglie tutto ciò che scrive sullo standard output e chiama `callback(err, buffer)` quando il processo termina o fallisce. `args` può essere un array o un singolo valore. L'ordine di `callback` e `timeout` può essere invertito.

Example: Leggere l'output di uno script
```js
WORKER2('report', ['2024'], function(err, buffer) {
	var report = buffer.toString('utf8').parseJSON();
	console.log(report);
}, 30000);
```

Example: /workers/report.js
```js
var year = process.argv[2];
console.log(JSON.stringify({ year: year, total: 100 }));
```

### F.workers

Type: `property`

I processi in esecuzione avviati da WORKER().

Returns: `Object`

Un oggetto dei processi figli avviati da `WORKER()` e `WORKER2()`, indicizzati per id (`{name}_{number}`). Un processo viene rimosso quando termina. Quando l'app si ferma, vengono terminati tutti.

### PATH.workers([filename])

Type: `method`

Restituisce il percorso di un file nella directory /workers/.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `filename` | `String` | no |  | Un nome di file |

Returns: `String`

Unisce `directory_workers` (predefinito `/workers/`) con `filename` e restituisce il percorso completo.

Example: Verificare un file worker
```js
var exists = require('fs').existsSync(PATH.workers('resize.js'));
```

### isWORKER

Type: `property`

true quando il framework gira tramite LOAD() senza il server HTTP.

Returns: `Boolean`

La variabile globale è `false` per impostazione predefinita. `LOAD()` la imposta a `true` e `HTTP()` la riporta a `false`. Usala nel codice condiviso che, quando gira in un worker, non deve fare cose che richiedono un server web (per esempio avviare scheduler).

Example: Saltare un timer nei worker
```js
if (!isWORKER)
	setInterval(cleanup, 60000);
```

### LOAD([types], [cwd], [callback])

Type: `method`

Carica parti dell'app senza avviare il server HTTP.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `types` | `String|Array` | no |  | Le parti da caricare o da saltare |
| `cwd` | `String` | no |  | La directory dell'app |
| `callback` | `Function` | no |  | Chiamata quando l'app è caricata |

Returns: `Promise` Solo quando `callback` non è indicata

Usala nei file worker e negli script. Legge la configurazione e `.env`, carica le parti indicate in `types` e chiama `callback` (o risolve la promise restituita) quando sono pronte. Imposta `isWORKER` a `true` ed emette `load` e `ready`.

`types` è un array o una stringa separata da virgole o spazi, per esempio `'config,modules,schemas'`. I nomi con il prefisso `no` (`'nobundles'`) escludono una parte e caricano il resto. Il valore predefinito è `['nobundles', 'nopackages', 'nocomponents', 'nothemes']`. Aggiungi `'debug'` per girare in modalità debug e `'service'` per eseguire il timer `ON('service')`. Parti: `actions`, `builds`, `bundles`, `components`, `controllers`, `definitions`, `extensions`, `flowstreams`, `jsonschemas`, `middleware`, `models`, `modules`, `operations`, `packages`, `plugins`, `preferences`, `schemas`, `sitemap`, `tasks`, `themes`, `versions`.

Example: Un worker con schemi
```js
require('total4');
LOAD('config,schemas,modules', function() {
	console.log(isWORKER); // true
});
```

Example: Con await
```js
require('total4');
(async function() {
	await LOAD('nobundles,nopackages');
	console.log(CONF.name);
})();
```

### SHELL(command, [callback], [cwd])

Type: `method`

Esegue un comando shell.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `command` | `String` | yes |  | La riga di comando |
| `callback` | `Function` | no |  | `function(err, stdout, stderr)` |
| `cwd` | `String` | no | `the app directory` | La directory di lavoro |

Returns: `Promise` Solo quando `callback` non è indicata; si risolve con stdout

Esegue `command` con `child_process.exec()`. La directory di lavoro è `cwd` o la directory dell'app; la shell è `default_shell` quando è impostata. La callback riceve `(err, stdout, stderr)`. Senza callback la funzione restituisce una promise che si risolve con lo standard output. Quando usi la promise puoi passare `cwd` come secondo argomento.

Non inserire mai input dell'utente in `command` senza farne l'escape.

Example: Con una callback
```js
SHELL('df -h', function(err, stdout) {
	console.log(stdout);
});
```

Example: Con await e una directory
```js
var commit = await SHELL('git rev-parse HEAD', '/www/app/');
```

### default_shell : <value>

Type: `config`

La shell usata da SHELL().

Returns: `String`

Il percorso della shell per `SHELL()` (l'opzione `shell` di `child_process.exec()`). Quando non è impostata, Node.js usa `/bin/sh` su Unix e `cmd.exe` su Windows.

Example: Nel file di configurazione
```text
default_shell : /bin/bash
```

### options.cluster = 4

Type: `config`

Esegue l'app come cluster di più istanze.

Returns: `Number|String`

Un'opzione dello script di avvio di `total4/release` e `total4/debug`. Un numero avvia altrettante istanze dell'app; `'auto'` ne avvia una e aggiunge o rimuove istanze in base al loro tempo di risposta (vedi `options.cluster_limit`). Il processo master riavvia dopo un secondo un'istanza che termina. In modalità debug il master riavvia tutte le istanze quando un file cambia.

Quando `options.threads` è impostato, il valore si applica a ogni thread invece che all'app principale.

Example: index.js
```js
const options = {};
options.cluster = 4;
require('total4/release')(options);
```

### options.cluster_limit = 10

Type: `config`

Il numero massimo di istanze nel cluster automatico.

Returns: `Number`

Con `options.cluster = 'auto'`, il master interroga le istanze ogni cinque secondi. Aggiunge un'istanza quando la risposta media supera i 70 ms, finché il numero non raggiunge `cluster_limit`. Senza questa opzione non c'è limite. Quando un'istanza risponde velocemente, il master rimuove l'ultima istanza (al massimo ogni 25 secondi) se ha meno di due richieste in sospeso.

Example: index.js
```js
const options = {};
options.cluster = 'auto';
options.cluster_limit = 8;
require('total4/release')(options);
```

### options.tz = 'utc'

Type: `config`

Il fuso orario di un cluster.

Returns: `String`

In modalità cluster il master imposta `process.env.TZ` di tutte le istanze su questo valore. Se non lo imposti, il cluster gira in `'utc'`, qualunque sia il fuso orario del server.

Example: index.js
```js
const options = {};
options.cluster = 2;
options.tz = 'Europe/Bratislava';
require('total4/release')(options);
```

### options.threads = '/api/'

Type: `config`

Esegue ogni sottodirectory di /threads/ come app separata.

Returns: `String|Boolean`

Per ogni directory in `/threads/` l'app principale scrive uno script di avvio `{script}_{name}.js` nella radice e ne esegue il fork. Le richieste sotto `{threads}/{name}/` vengono inoltrate a quel thread tramite un socket Unix, senza il prefisso. `true` significa nessun prefisso (`/{name}/`).

Ogni thread carica i file `.js` della sua directory con `exports.install`, i propri file di configurazione e `.env`, `views/` e `public/`. Salta le directory `/controllers/` e `/middleware/` della radice.

Example: index.js
```js
const options = {};
options.threads = '/api/';
require('total4/release')(options);
```

Example: /threads/users/index.js
```js
exports.install = function() {
	// Serves GET /api/users/
	ROUTE('GET /', function() {
		this.json({ thread: THREAD });
	});
};
```

### options.thread = 'name'

Type: `config`

Il nome del thread del processo.

Returns: `String`

Imposta la variabile globale `THREAD` e carica l'app come thread `/threads/{name}/`. Gli script scritti da `options.threads` la impostano per te. In modalità cluster, il file di riavvio è `restart_{name}`.

### options.logs = 'isolated'

Type: `config`

Scrive l'output di ogni thread nel proprio file di log.

Returns: `String`

Con `'isolated'`, l'output di un thread va in `/threads/{name}/logs/debug.log` invece che nella console dell'app principale. Il file viene svuotato all'avvio del thread (in modalità debug solo al primo avvio).

### THREAD

Type: `property`

Il nome del thread corrente.

Returns: `String`

Una stringa vuota in un'app normale. All'interno di un thread di `/threads/{name}/` è il nome del thread. Il framework lo aggiunge al banner della console e ai log di audit.

Example: Usare il nome del thread
```js
var key = THREAD ? ('cache_' + THREAD) : 'cache';
```

### F.threads

Type: `property`

I processi figli dei thread, per nome.

Returns: `Object`

Nell'app principale con `options.threads`, un oggetto in cui ogni chiave è il nome di un thread e ogni valore è il suo `ChildProcess`. Altrimenti `undefined`.

### F.isCluster

Type: `property`

true in un'istanza di un cluster.

Returns: `Boolean`

`true` quando il processo è un'istanza avviata dal master del cluster.

Example: Eseguire un job in una sola istanza
```js
if (!F.isCluster || F.id === '0')
	SCHEDULE('03:00', '1 day', cleanup);
```

### F.id

Type: `property`

L'id dell'istanza in un cluster.

Returns: `String`

L'indice dell'istanza come stringa (`'0'`, `'1'`, ...), oppure `null` fuori da un cluster. I file temporanei di un'istanza ricevono il prefisso `cluster_{id}_`.

### F.cluster.emit(name, [a], [b], [c], [d], [e])

Type: `method`

Genera un evento in ogni istanza del cluster.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | yes |  | Il nome dell'evento |
| `a` | `Object` | no |  | Fino a cinque argomenti |

Returns: `Framework`

Invia l'evento tramite il master a tutte le istanze, incluso il mittente. Ogni istanza chiama i suoi listener `ON(name)` con un massimo di cinque argomenti. Gli argomenti viaggiano come messaggi IPC, quindi devono essere serializzabili. Fuori da un cluster non fa nulla.

Example: Svuotare una cache ovunque
```js
ON('settings_changed', function() {
	CACHE('settings', null);
});

F.cluster.emit('settings_changed');
```

### F.cluster.master(name, [a], [b], [c], [d], [e])

Type: `method`

Invia un evento da un'istanza al processo master.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | yes |  | Il nome dell'evento |
| `a` | `Object` | no |  | Fino a cinque argomenti |

Returns: `Framework`

Il master chiama i listener registrati con `F.cluster.on(name)`. Fuori da un cluster non fa nulla.

Example: Comunicare al master
```js
F.cluster.master('visit', F.id);
```

### F.cluster.on(name, callback)

Type: `method`

Ascolta nel processo master gli eventi di F.cluster.master().

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `String` | yes |  | Il nome dell'evento |
| `callback` | `Function` | yes |  | `function(a, b, c, d, e)` |

Returns: `Framework`

Registralo nello script di avvio: il master esegue quello script, e lo stesso fa ogni istanza. La callback riceve gli argomenti di `F.cluster.master()`. Registra un solo listener per nome.

Example: index.js
```js
const options = {};
options.cluster = 4;
require('total4/release')(options);

var visits = 0;
F.cluster.on('visit', function(id) {
	visits++;
});
```

### F.cluster.restart([index])

Type: `method`

Riavvia le istanze del cluster dal processo master.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `index` | `Number` | no |  | L'indice dell'istanza |

Riavvia l'istanza con `index`, oppure tutte le istanze a due secondi di distanza quando `index` non è indicato. Funziona solo nel processo master. Dall'esterno, crea invece il file `restart`.

Example: Riavviare tutte le istanze dallo script di avvio
```js
// index.js
const options = {};
options.cluster = 4;
require('total4/release')(options);

// The start script also runs in every instance, so check the master
if (require('cluster').isMaster)
	setInterval(() => F.cluster.restart(), 24 * 60 * 60 * 1000);
```

### F.cluster.http(count, mode, [options], [callback])

Type: `method`

Avvia un cluster con un server HTTP.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `count` | `Number|String` | yes |  | Numero di istanze o `'auto'` |
| `mode` | `String` | yes |  | `'debug'` o `'release'` |
| `options` | `Object` | no |  | Opzioni di avvio |
| `callback` | `Function` | no |  | `function(forks)` |

È ciò che `options.cluster` chiama nello script di avvio. `count` è un numero, `'auto'` o `null` (un'istanza per core della CPU). `mode` è `'debug'` o `'release'`. `options` sono le opzioni di avvio che ricevono le istanze. Nel master, `callback` viene chiamata con l'array delle istanze quando sono state avviate tutte. `F.cluster.https()` accetta gli stessi argomenti e avvia server HTTPS.

Example: Avviare direttamente un cluster
```js
require('total4').cluster.http(4, 'release', { port: 8000 });
```

### restart

Type: `command`

Un file che riavvia tutte le istanze di un cluster in esecuzione.

Il master controlla ogni cinque secondi se esiste un file chiamato `restart` nella directory dell'app (`restart_{thread}` quando `options.thread` è impostato). Quando lo trova, elimina il file e riavvia tutte le istanze a due secondi di distanza, al massimo una volta ogni 30 secondi. Usalo dopo un deploy per caricare il nuovo codice senza fermare l'app.

Il master scrive anche il suo stato (PID, versioni, numero di istanze, memoria e statistiche di ogni istanza) in un file con il nome dello script di avvio più `.json`, per esempio `index.js.json`, circa ogni 50 secondi.

Example: Riavviare dopo un deploy
```bash
touch /www/app/restart
```

### allow_cache_cluster : false

Type: `config`

Sincronizza la cache del framework tra le istanze del cluster.

Returns: `Boolean`

Quando è `true`, ogni `CACHE()` / `F.cache.set()`, `remove()`, `removeAll()` e `clear()` in un'istanza viene ripetuto nelle altre istanze. In un cluster le sessioni sono sincronizzate anche senza questa opzione.

Example: Nel file di configurazione
```text
allow_cache_cluster : true
```
