feat(core): Add cache service (#6729)

* add cache service

* PR adjustments

* switch to maxSize for memory cache
This commit is contained in:
Michael Auerswald
2023-07-25 11:56:38 +02:00
committed by GitHub
parent e1e6d4a749
commit c0d2bac94d
5 changed files with 397 additions and 1 deletions

View File

@@ -1101,4 +1101,41 @@ export const schema = {
},
},
},
cache: {
enabled: {
doc: 'Whether caching is enabled',
format: Boolean,
default: true,
env: 'N8N_CACHE_ENABLED',
},
backend: {
doc: 'Backend to use for caching',
format: ['memory', 'redis', 'auto'] as const,
default: 'auto',
env: 'N8N_CACHE_BACKEND',
},
memory: {
maxSize: {
doc: 'Maximum size of memory cache in bytes',
format: Number,
default: 3 * 1024 * 1024, // 3 MB
env: 'N8N_CACHE_MEMORY_MAX_SIZE',
},
ttl: {
doc: 'Time to live for cached items in memory (in ms)',
format: Number,
default: 3600 * 1000, // 1 hour
env: 'N8N_CACHE_MEMORY_TTL',
},
},
redis: {
ttl: {
doc: 'Time to live for cached items in redis (in ms), 0 for no TTL',
format: Number,
default: 0,
env: 'N8N_CACHE_REDIS_TTL',
},
},
},
};