3 # Save memory usage options
5 require './squid-lib.pl';
6 $access{'musage'} || &error($text{'emem_ecannot'});
8 &lock_file($config{'squid_conf'});
10 $whatfailed = $text{'smem_ftsmo'};
12 if ($squid_version < 2) {
13 &save_opt("cache_mem", \&check_size, $conf);
14 &save_opt("cache_swap", \&check_size, $conf);
17 &save_opt_bytes("cache_mem", $conf);
18 &save_opt("fqdncache_size", \&check_size, $conf);
20 if ($squid_version < 2.5) {
21 &save_opt("cache_mem_high", \&check_high, $conf);
22 &save_opt("cache_mem_low", \&check_low, $conf);
24 &save_opt("cache_swap_high", \&check_high, $conf);
25 &save_opt("cache_swap_low", \&check_low, $conf);
26 if ($squid_version < 2) {
27 &save_opt("maximum_object_size", \&check_obj_size, $conf);
30 &save_opt_bytes("maximum_object_size", $conf);
32 &save_opt("ipcache_size", \&check_size, $conf);
33 &save_opt("ipcache_high", \&check_high, $conf);
34 &save_opt("ipcache_low", \&check_low, $conf);
35 if ($squid_version >= 2.4) {
36 &save_choice("cache_replacement_policy", '', $conf);
37 &save_choice("memory_replacement_policy", '', $conf);
40 &unlock_file($config{'squid_conf'});
41 &webmin_log("mem", undef, undef, \%in);
46 return $_[0] =~ /^\d+$/ ? undef : &text('smem_emsg1',$_[0]);
51 return $_[0] =~ /^\d+$/ && $_[0] > 0 && $_[0] <= 100
52 ? undef : &text('smem_emsg2',$_[0]);
57 return $_[0] =~ /^\d+$/ && $_[0] > 0 && $_[0] <= 100
58 ? undef : &text('smem_emsg3',$_[0]);
63 return $_[0] =~ /^\d+$/ ? undef : &text('smem_emsg4',$_[0]);