introduce a cache control: a way of keeping the cache directory under certain size (should fix #229)

This commit is contained in:
teddit
2021-08-24 17:17:46 +02:00
parent e311ce717c
commit e0b5cc6e40
3 changed files with 64 additions and 0 deletions

View File

@@ -32,6 +32,9 @@ const config = {
domain_replacements: process.env.DOMAIN_REPLACEMENTS
? (JSON.parse(process.env.DOMAIN_REPLACEMENTS).map(([p, r]) => [new RegExp(p, 'gm'), r]))
: [], // Replacements for domains in outgoing links. Tuples with regular expressions to match, and replacement values. This is in addition to user-level configuration of privacyDomains.
cache_control: process.env.CACHE_CONTROL !== 'true' || true, // If true, teddit will automatically try to keep the size of the cache directory (static) under config.cache_max_size. By default this is set to true.
cache_max_size: process.env.CACHE_MAX_SIZE || 3000, // How much can we cache to the disk? Default is 3000 MB (~3 GB). Note: This is not perfectly exact limit.
cache_control_interval: process.env.CACHE_CONTROL_INTERVAL || 1000 * 60 * 30, // How often the size of the cache directory (static/) is checked. Default is every 30 minutes.
post_media_max_heights: {
/**
* Sets the max-height value for images and videos in posts.