Configuring Storage for MaxScale's Cache Filter
This page is part of MariaDB's Documentation.
The parent of this page is: Cache Filter
Topics on this page:
Overview
MaxScale's Cache Filter (cache) caches the result-sets of statements to improve query performance.
This page explains how to configure the filter to use various types of storage.
Storage Types
The storage used by the Cache Filter (cache) is configured by the storage parameter.
There are two different types of storage: local storage and shared storage.
Local Storage
The Cache Filter currently supports one type of local storage:
Value | Description |
|---|---|
|
|
Configuring the Cache Filter to use Memcached
Configure the Cache Filter to use memcached by setting the
storageparameter tostorage_memcachedinmaxscale.cnf.You will also need to set specific memcached-related options using the
storage_optionsparameter. Options should be supplied as a comma-separated string.Option
Description
serverThis option defines the address of the memcached instance, in the format:
host[:port].If the port is not specified, then 11211 is used by default.
This option is mandatory.
max_value_sizeThis option defines the maximum size of a cached value.
The unit is bytes, but EIC binary prefixes (
Ki,Mi,Gi, andTi) and SI prefixes (k,M,G, andT) can also be specified.If the value of this option is lower than the value of the
max_result_sizeparameter for the Cache Filter, then the value of this option will be the effective maximum result size.The default value is 1 MB.
This option is optional.
For example:
[split-router-cache] type = filter module = cache hard_ttl = 30s soft_ttl = 20s ... storage = storage_memcached storage_options = server=192.0.2.100:11211, max_value_size=10M [cached-split-router] type = service router = readwritesplit ... filters = split-router-cache
Restart the MaxScale instance.
$ sudo systemctl restart maxscale
Configuring the Cache Filter to use Redis
Configure the Cache Filter to use Redis by setting the
storageparameter tostorage_redisinmaxscale.cnf.You will also need to set specific Redis-related options using the
storage_optionsparameter. Options should be supplied as a comma-separated string.Option
Description
serverThis option defines the address of the Redis instance, in the format:
host[:port].If the port is not specified, then 6379 is used by default.
This option is mandatory.
For example:
[split-router-cache] type = filter module = cache hard_ttl = 30s soft_ttl = 20s ... storage = storage_redis storage_options = server=192.0.2.100:6379 [cached-split-router] type = service router = readwritesplit ... filters = split-router-cache
Restart the MaxScale instance.
$ sudo systemctl restart maxscale
