# News configuration

The following configuration items define how Transformer manages news headline data.

## add-newsconfig

`add-newsconfig` specifies purging settings for a particular news stream. Transformer retains newly received news headlines in a memory cache. Headlines can be purged (deleted) from the cache at daily intervals (as specified by [`news-purge-time`](#news-purge-time)), and also when the cache exceeds a given size.

Also see, [`news-purge-days`](#news-purge-days) and [`news-max-headlines`](#news-max-headlines).

**Syntax:**

```
add-newsconfig
   xref:symbol[symbol]            [string]
   xref:purge-days[purge-days]        [double]
   xref:max-headlines[max-headlines]     [integer]
end-newsconfig
```

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| <a name="max-headlines"></a>`max-headlines` | integer | `-1` (unlimited: headlines for this news stream are never deleted from the cache) | The maximum number of headlines that that Transformer caches in memory for this news stream. When the maximum number of stored headlines for this stream is reached, the arrival of a new headline causes the oldest headline to be deleted. This option overrides the setting of [`news-max-headlines`](#news-max-headlines). TIP: If you don’t set a value for `max-headlines`, you should set [`news-purge-time`](#news-purge-time) instead, otherwise headlines will never be deleted from the cache, and Transformer could fail by running out of memory. |
| <a name="purge-days"></a>`purge-days` | double | `0` days (all headlines are purged for this news stream) | The number of day’s worth of headlines for this news stream to retain during a daily purge of news headlines from Transformer’s cache, counting back from when the purge occurs. This option overrides the setting of [`news-purge-days`](#news-purge-days). To enable daily purging, specify [`news-purge-time`](#news-purge-time). |
| <a name="symbol"></a>`symbol` | string | +[none]+ | The symbol that identifies this news stream. |

## news-max-headlines

`news-max-headlines` specifies the maximum number of new headlines that Transformer caches in memory for a particular news stream. When the maximum number of stored headlines is reached for a stream, the arrival of a new headline causes the oldest headline to be deleted.

The value of this item can be overridden for a specific news stream by the [`max-headlines`](#max-headlines) option of an [`add-newsconfig`](#add-newsconfig) item for that stream.

**💡 TIP**\
If you don’t set a value for `news-max-headlines`, you should set [`news-purge-time`](#news-purge-time) instead, otherwise headlines will never be deleted from the cache, and Transformer could fail by running out of memory.

**Syntax:** `news-max-headlines <number-of-headlines>`

**Type:** integer

**Default value:** `-1` (unlimited: headlines are never deleted from the cache, unless [`news-purge-time`](#news-purge-time) is set.)

## news-purge-days

`news-purge-days` specifies the number of day’s worth of headlines to retain for each news stream during a daily purge of news headlines from Transformer’s cache, counting back from when the purge occurs.

The value of this item can be overridden for a specific news stream by the [`purge-days`](#purge-days) option of an [`add-newsconfig`](#add-newsconfig) item for that stream.

To enable daily purging, specify [`news-purge-time`](#news-purge-time).

**Syntax:** `news-purge-days <days>`

**Type:** integer

**Default value:** `0` days (all headlines are purged)

## news-purge-time

`news-purge-time` schedules a time of day, in minutes after midnight, to purge old news headlines from Liberator’s cache.

**💡 TIP**\
If you don’t set a value for `news-purge-time`, you should set [`news-max-headlines`](#news-max-headlines) instead, otherwise headlines will never be deleted from the cache, and Transformer could fail by running out of memory.

To specify the maximum age of headlines to retain during a purge, set [`news-purge-days`](#news-purge-days).

**Syntax:** `news-purge-time <minutes-after-midnight>`

**Type:** integer

**Default value:** `-1` (Purging of news headlines is disabled, in which case, if it’s defined, [`news-max-headlines`](#news-max-headlines) limits the number of headlines stored.)
