In the simpliest case we have a single website and define
pagespeed FileCachePath /var/ngx_pagespeed_cache;
pagespeed FileCacheSizeKb 2048000;
Thus being sure that the disk space taken by the folder /var/ngx_pagespeed_cache will not exceed 2Gb.
Ok but in my use case there are tens of websites and I want them to have separate caches so that I can flush one of the caches without hurting the others.
So the first question is: does FileCacheSizeKb set up a global cache size limit or is it per virtual host?
If I have, say, two websites and I do not specify different FileCachePath for virtual hosts, will it mean that the size of /var/ngx_pagespeed_cache is now limited by 4Gb instead of 2Gb?
And if I do specify two different FileCachePath's, will it be 2Gb per folder?
It seems that it should be the case since I can also specify separate FileCacheSizeKb directives within server blocks... But it's not obvious and I haven't managed to find the answer in the docs.
Now the second question is: if I use memcached as external cache, how does FileCacheSizeKb correlate with memcached's limit?
Does FileCacheSizeKb only apply to disk space consumed by FileCachePath folder or is limits the total cache size (folder + memcached)?
For example, my memcached's limit is 1Gb and FileCacheSizeKb is 2Gb - does it mean that memcached will reach it's limit some day but the cache cleaning process will never trigger since 1Gb is lower than 0.75 * FileCacheSizeKb?
Ok, the issue's been solved.
In case anyone else needs an answer:
If you configure FileCachePath at the server{} level, you will get a separate cache for that vhost. If you configure it globally, you will get a single file system cache, shared between vhosts.
Limit form memcached and file cache are separated items. Objects < 1Mb are stored in memcached objects > 1Mb are stored in file cache, until theirs own limits.
Also it seems that pagespeed doesn't have a cleaning mechanism for memcached so there may be issues in case of low memcached limit, be careful with that