save_mem.cgi

来自「Unix下基于Web的管理工具」· CGI 代码 · 共 56 行

CGI
56
字号
#!/usr/local/bin/perl# save_mem.cgi# Save memory usage optionsrequire './squid-lib.pl';&ReadParse();$conf = &get_config();$whatfailed = "Failed to save memory options";if ($squid_version < 2) {	&save_opt("cache_mem", \&check_size, $conf);	&save_opt("cache_swap", \&check_size, $conf);	}else {	&save_opt_bytes("cache_mem", $conf);	&save_opt("fqdncache_size", \&check_size, $conf);	}&save_opt("cache_mem_high", \&check_high, $conf);&save_opt("cache_mem_low", \&check_low, $conf);&save_opt("cache_swap_high", \&check_high, $conf);&save_opt("cache_swap_low", \&check_low, $conf);if ($squid_version < 2) {	&save_opt("maximum_object_size", \&check_obj_size, $conf);	}else {	&save_opt_bytes("maximum_object_size", $conf);	}&save_opt("ipcache_size", \&check_size, $conf);&save_opt("ipcache_high", \&check_high, $conf);&save_opt("ipcache_low", \&check_low, $conf);&flush_file_lines();&redirect("");sub check_size{return $_[0] =~ /^\d+$/ ? undef : "'$_[0]' is not a valid cache size";}sub check_high{return $_[0] =~ /^\d+$/ && $_[0] > 0 && $_[0] <= 100		? undef : "'$_[0]' is not a valid high-water mark";}sub check_low{return $_[0] =~ /^\d+$/ && $_[0] > 0 && $_[0] <= 100		? undef : "'$_[0]' is not a valid low-water mark";}sub check_obj_size{return $_[0] =~ /^\d+$/ ? undef : "'$_[0]' is not a valid object size";}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?