Configuration

Relay provides several configuration directives and the relay.ini file is easily located by running:

php --ini

It’s strongly recommended to set the relay.maxmemory, relay.eviction_policy and relay.databases directives. If you have a license, be sure to set the relay.key and relay.environment as well.

Memory limits

Relay will allocate what relay.maxmemory is set to when PHP starts, even if no relay.key. However if no valid license was set, after 60 minutes of runtime, Relay will downsize the allocated memory to its hard limit of 32 MB.

Disabling the cache

Sometimes you may wish to install the Relay extension, but not have it allocate memory, either because you want to only use it as a faster alternative to PhpRedis, or to keep it dormant for future use.

You may disable all in-memory caching and memory allocation by setting:

relay.maxmemory = 0

Default configuration

; The path to the extension binary.
; Relative paths will look in `php-config --extension-dir`.
;
extension = relay.so

; Relay license key (via https://relay.so).
; Without a license key Relay will throttle to 32MB memory one hour after startup.
;
; relay.key =

; The environment Relay is running in.
; Supported values: `production`, `staging`, `testing`, `development`
;
; relay.environment = development

; How much memory Relay allocates on startup. This value can either be a
; number like 33554432 or with a unit (e.g. 32M) like memory_limit.
; Set to `0` to use Relay as a client without in-memory caching.
; See: https://php.net/manual/faq.using.php#faq.using.shorthandbytes 
;
; relay.maxmemory = 32M

; At what percentage of used memory should Relay start evicting keys.
;
; relay.maxmemory_pct = 75

; How should relay evict keys. This has been designed to mirror Redis’
; options and we currently support `noeviction`, `lru`, and `random`.
;
; relay.eviction_policy = noeviction

; How many keys should we scan each time we process evictions.
;
; relay.eviction_sample_keys = 128

; Default to using a persistent connection when calling `connect()`.
;
; relay.default_pconnect = 1

; The number of databases Relay will create per in-memory cache.
; This setting should match the `databases` setting in your `redis.conf`.
;
; relay.databases = 16

; The maximum number of in-memory databases Relay will create per endpoint.
;
; relay.max_endpoint_dbs = 16

; The number of epoch readers allocated on startup.
;
; relay.initial_readers = 128

; How often (in microseconds) Relay should proactively check the
; connection for invalidation messages from Redis.
;
; relay.invalidation_poll_freq = 5

; Whether Relay should log debug information.
; Supported levels: `debug`, `verbose`, `error`, `off`
;
; relay.loglevel = off

; The name of the file where information should be logged, if logging is enabled.
;
; relay.logfile = /tmp/relay.log