Adding additional memory cache options for squid webproxy (#5160)

This commit is contained in:
2021-08-12 16:05:00 +02:00 committed by GitHub
parent 8904cae0ed
commit a3be99d8dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 1 deletions

View File

@ -177,6 +177,25 @@
<help>Set the maximum object size (default 4MB when left empty).</help>
<advanced>true</advanced>
</field>
<field>
<id>proxy.general.cache.local.maximum_object_size_in_memory</id>
<label>Maximum object size in memory (KB)</label>
<type>text</type>
<help>Set the maximum object size in memory (default 512KB when left empty).</help>
<advanced>true</advanced>
</field>
<field>
<id>proxy.general.cache.local.memory_cache_mode</id>
<label>Memory cache mode</label>
<type>dropdown</type>
<help>
Controls which objects to keep in the memory cache (cache_mem)
always: Keep most recently fetched objects in memory (default)
disk: Only disk cache hits are kept in memory, which means an object must first be cached on disk and then hit a second time before cached in memory.
network: Only objects fetched from network is kept in memory
</help>
<advanced>true</advanced>
</field>
<field>
<id>proxy.general.cache.local.cache_linux_packages</id>
<label>Enable Linux Package Cache</label>

View File

@ -1,6 +1,6 @@
<model>
<mount>//OPNsense/proxy</mount>
<version>1.0.4</version>
<version>1.0.5</version>
<description>
(squid) proxy settings
</description>
@ -131,6 +131,22 @@
<ValidationMessage>Specify a maximum object size. (number of MB's)</ValidationMessage>
<Required>N</Required>
</maximum_object_size>
<maximum_object_size_in_memory type="IntegerField">
<MinimumValue>1</MinimumValue>
<MaximumValue>99999</MaximumValue>
<ValidationMessage>Specify a maximum object size in memory. (number of KB's)</ValidationMessage>
<Required>N</Required>
</maximum_object_size_in_memory>
<memory_cache_mode type="OptionField">
<default>always</default>
<Required>N</Required>
<BlankDesc>Default</BlankDesc>
<OptionValues>
<always>Keep all most recent files (always)</always>
<disk>Keep most recent HIT files(disk)</disk>
<network>Keep only files fetched from network (network)</network>
</OptionValues>
</memory_cache_mode>
<size type="IntegerField">
<default>100</default>
<MinimumValue>1</MinimumValue>

View File

@ -313,6 +313,12 @@ maximum_object_size {{OPNsense.proxy.general.cache.local.maximum_object_size}} M
cache_replacement_policy heap LFUDA
{% endif %}
{% endif %}
{% if OPNsense.proxy.general.cache.local.maximum_object_size_in_memory|default('') != '' %}
maximum_object_size_in_memory {{OPNsense.proxy.general.cache.local.maximum_object_size_in_memory}} KB
{% endif %}
{% if OPNsense.proxy.general.cache.local.memory_cache_mode|default('always') != 'always' %}
memory_cache_mode {{OPNsense.proxy.general.cache.local.memory_cache_mode}}
{% endif %}
{% if OPNsense.proxy.general.cache.local.enabled == '1' %}
cache_dir ufs {{OPNsense.proxy.general.cache.local.directory}} {{OPNsense.proxy.general.cache.local.size}} {{OPNsense.proxy.general.cache.local.l1}} {{OPNsense.proxy.general.cache.local.l2}}
{% endif %}