# Memory and cache configuration

These configuration items relate to Caplin Transformer’s core memory and caching functions

## add-purge

`add-purge` specifies how often a particular object, or set of objects, is to be purged (deleted) from Transformer’s object cache. If the Transformer is consuming data from a [broadcast](../datasource/datasource-broadcasting-data.md) feed, it may be useful to remove broadcast objects from the cache that haven’t been updated after a certain period of time.

**Syntax:** `add-purge <symbol-pattern> <purge-time> <purge-days>`

| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `symbol-pattern` | string | +[none]+ | A regular expression that selects the [symbols](../datasource/datasource-subjects-symbols-and-fields.md) (subject names) of the objects to be purged. For example: * `^/FX` selects all the symbols that start with `/FX` * `^/FX/GBPUSD$` selects the symbol `/FX/GBPUSD` |
| `purge-time` | integer | `-1` | The time, in minutes past midnight, when Transformer attempts to purge the object from its cache. Set to -1 (default) to disable purge. TIP: If you don’t specify the `purge-time` parameter or it’s invalid, Transformer ignores this `add-purge` item, and the affected objects will never be purged. |
| `purge-days` | integer | +[none]+ | The selected objects are purged when they are more than `purge-days` old. TIP: If you don’t specify the `purge-days` parameter or it’s invalid, Transformer ignores this `add-purge` item, and the affected objects will never be purged. |

## memory-file

`memory-file` specifies the location of the file to which the object cache is saved every [`write-cache-period`](#write-cache-period) and when Transformer shuts down. The cache is restored from this file whenTransformer starts up.

The directory path can contain any of the following parameters:

| Parameter | Replaced at run time by: |
| --- | --- |
| `%r` | The root directory ([`application-root`](../datasource/datasource-run-time-environment-configuration.md#application-root)) under which the Transformer runs |
| `%a` | The name of the Transformer ([`application-name`](../datasource/datasource-run-time-environment-configuration.md#application-name)) |
| `%u` | The home directory of the account from where the Transformer was started. |
| `%h` | The hostname of the machine on which the Transformer is running. |

**Syntax:** `memory-file <file-path>`

**Type:** string

**Default value:** `%r/var/memory`

Also see [`cluster-nosave-on-secondary`](transformer-clustering-configuration.md#cluster-nosave-on-secondary) in [Clustering configuration](transformer-clustering-configuration.md).

## memory-hash-size

`memory-hash-size` specifies the size of Transformer’s object hash table in elements. The hash table is the access mechanism for Transformer’s object cache; each element is a slot for the hash code that identifies an object in the cache. This item is used to tune Transformer’s performance; its value should normally be roughly twice the total number of objects that need to be cached.

**Syntax:** `memory-hash-size <size-in-table-elements>`

**Type:** integer

**Default value:** 16384 hash table elements

## permission-hash-size

`permission-hash-size` specifies the initial size, in elements, of the hash table that holds updates to [permissions data](../datasource/datasource-permissions.md). updates. The table automatically grows past the configured or default size, as required.

**Syntax:** `permission-hash-size <size-in-table-elements>`

**Type:** integer

**Default value:** `65536` hash table elements

## symboluser-hashsize

`symboluser-hashsize` specifies the size (in elements) of the hash table that holds the details of the C functions used to support caching of data specific to individual Transformer modules. For more about this, see the Transformer _[C Module API documentation,opts="nofollow"](https://docs.caplin.com/developer/api/transformer_c_sdk/6/)_ under "_Modules > Module caching functionality_".

**Syntax:** `symboluser-hashsize <size-in-table-elements>`

**Type:** integer

**Default value:** `63` hash table elements

## write-cache-period

`write-cache-period` specifies the interval in seconds between writes to the object cache file whose location is specifed by [`memory-file`](#memory-file). Transformer persists its object cache to this file every `write-cache-period`.

**Syntax:** `write-cache-period <interval-in-seconds>`

**Type:** float

**Default value:** `30.0` seconds

---

**See also:**

* Reference: [Objects configuration](transformer-objects-configuration.md)
