Align memcached configurations for multiple hosts (#7986)

* align memcached configurations for multiple hosts

* update reference
This commit is contained in:
Azri Kahar
2021-09-14 00:48:26 +08:00
committed by GitHub
parent 0fd26d9597
commit e29d803abe
2 changed files with 15 additions and 10 deletions

View File

@@ -57,7 +57,12 @@ function getConfig(store: 'memory' | 'redis' | 'memcache' = 'memory', ttl: numbe
if (store === 'memcache') {
const KeyvMemcache = require('keyv-memcache');
config.store = new KeyvMemcache(env.CACHE_MEMCACHE);
// keyv-memcache uses memjs which only accepts a comma separated string instead of an array,
// so we need to join array into a string when applicable. See #7986
const cacheMemcache = Array.isArray(env.CACHE_MEMCACHE) ? env.CACHE_MEMCACHE.join(',') : env.CACHE_MEMCACHE;
config.store = new KeyvMemcache(cacheMemcache);
}
return config;

View File

@@ -143,9 +143,9 @@ Alternatively, you can provide the individual connection parameters:
### Memcache
| Variable | Description | Default Value |
| ----------------------- | ---------------------------------- | ------------- |
| `RATE_LIMITER_MEMCACHE` | Location of your memcache instance | --- |
| Variable | Description | Default Value |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
| `RATE_LIMITER_MEMCACHE` | Location of your memcache instance. You can use [`array:` syntax](#environment-syntax-prefix), eg: `array:<instance-1>,<instance-2>` for multiple memcache instances. | --- |
::: tip Additional Rate Limiter Variables
@@ -191,9 +191,9 @@ Alternatively, you can provide the individual connection parameters:
### Memcache
| Variable | Description | Default Value |
| ---------------- | ---------------------------------- | ------------- |
| `CACHE_MEMCACHE` | Location of your memcache instance | --- |
| Variable | Description | Default Value |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
| `CACHE_MEMCACHE` | Location of your memcache instance. You can use [`array:` syntax](#environment-syntax-prefix), eg: `array:<instance-1>,<instance-2>` for multiple memcache instances. | --- |
## Sessions
@@ -225,9 +225,9 @@ Alternatively, you can provide the individual connection parameters:
### Memcache
| Variable | Description | Default Value |
| ------------------------ | ---------------------------------- | ------------- |
| `SESSION_MEMCACHE_HOSTS` | Location of your memcache instance | --- |
| Variable | Description | Default Value |
| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
| `SESSION_MEMCACHE_HOSTS` | Location of your memcache instance. You can use [`array:` syntax](#environment-syntax-prefix), eg: `array:<instance-1>,<instance-2>` for multiple memcache instances. | --- |
### Database