Page Speed Optimization Libraries
1.4.26.1
|
00001 // Copyright 2013 Google Inc. 00016 00017 #ifndef NET_INSTAWEB_SYSTEM_PUBLIC_SYSTEM_REWRITE_OPTIONS_H_ 00018 #define NET_INSTAWEB_SYSTEM_PUBLIC_SYSTEM_REWRITE_OPTIONS_H_ 00019 00020 #include "net/instaweb/rewriter/public/rewrite_options.h" 00021 #include "net/instaweb/util/public/basictypes.h" 00022 #include "net/instaweb/util/public/string.h" 00023 #include "net/instaweb/util/public/string_util.h" 00024 00025 namespace net_instaweb { 00026 00029 class SystemRewriteOptions : public RewriteOptions { 00030 public: 00031 static void Initialize(); 00032 static void Terminate(); 00033 00034 SystemRewriteOptions(); 00035 virtual ~SystemRewriteOptions(); 00036 00037 int64 file_cache_clean_interval_ms() const { 00038 return file_cache_clean_interval_ms_.value(); 00039 } 00040 void set_file_cache_clean_interval_ms(int64 x) { 00041 set_option(x, &file_cache_clean_interval_ms_); 00042 } 00043 int64 file_cache_clean_size_kb() const { 00044 return file_cache_clean_size_kb_.value(); 00045 } 00046 void set_file_cache_clean_size_kb(int64 x) { 00047 set_option(x, &file_cache_clean_size_kb_); 00048 } 00049 int64 file_cache_clean_inode_limit() const { 00050 return file_cache_clean_inode_limit_.value(); 00051 } 00052 void set_file_cache_clean_inode_limit(int64 x) { 00053 set_option(x, &file_cache_clean_inode_limit_); 00054 } 00055 int64 lru_cache_byte_limit() const { 00056 return lru_cache_byte_limit_.value(); 00057 } 00058 void set_lru_cache_byte_limit(int64 x) { 00059 set_option(x, &lru_cache_byte_limit_); 00060 } 00061 int64 lru_cache_kb_per_process() const { 00062 return lru_cache_kb_per_process_.value(); 00063 } 00064 void set_lru_cache_kb_per_process(int64 x) { 00065 set_option(x, &lru_cache_kb_per_process_); 00066 } 00067 bool use_shared_mem_locking() const { 00068 return use_shared_mem_locking_.value(); 00069 } 00070 void set_use_shared_mem_locking(bool x) { 00071 set_option(x, &use_shared_mem_locking_); 00072 } 00073 bool statistics_enabled() const { 00074 return statistics_enabled_.value(); 00075 } 00076 void set_statistics_enabled(bool x) { 00077 set_option(x, &statistics_enabled_); 00078 } 00079 bool statistics_logging_enabled() const { 00080 return statistics_logging_enabled_.value(); 00081 } 00082 void set_statistics_logging_enabled(bool x) { 00083 set_option(x, &statistics_logging_enabled_); 00084 } 00085 const GoogleString& statistics_logging_file() const { 00086 return statistics_logging_file_.value(); 00087 } 00088 const GoogleString& statistics_logging_charts_css() const { 00089 return statistics_logging_charts_css_.value(); 00090 } 00091 const GoogleString& statistics_logging_charts_js() const { 00092 return statistics_logging_charts_js_.value(); 00093 } 00094 void set_statistics_logging_file(GoogleString x) { 00095 set_option(x, &statistics_logging_file_); 00096 } 00097 int64 statistics_logging_interval_ms() const { 00098 return statistics_logging_interval_ms_.value(); 00099 } 00100 void set_statistics_logging_interval_ms(int64 x) { 00101 set_option(x, &statistics_logging_interval_ms_); 00102 } 00103 const GoogleString& file_cache_path() const { 00104 return file_cache_path_.value(); 00105 } 00106 void set_file_cache_path(GoogleString x) { 00107 set_option(x, &file_cache_path_); 00108 } 00109 const GoogleString& memcached_servers() const { 00110 return memcached_servers_.value(); 00111 } 00112 void set_memcached_servers(GoogleString x) { 00113 set_option(x, &memcached_servers_); 00114 } 00115 int memcached_threads() const { 00116 return memcached_threads_.value(); 00117 } 00118 void set_memcached_threads(int x) { 00119 set_option(x, &memcached_threads_); 00120 } 00121 int memcached_timeout_us() const { 00122 return memcached_timeout_us_.value(); 00123 } 00124 bool has_memcached_timeout_us() const { 00125 return memcached_timeout_us_.was_set(); 00126 } 00127 void set_memcached_timeout_us(int x) { 00128 set_option(x, &memcached_timeout_us_); 00129 } 00130 const GoogleString& fetcher_proxy() const { 00131 return fetcher_proxy_.value(); 00132 } 00133 void set_fetcher_proxy(GoogleString x) { 00134 set_option(x, &fetcher_proxy_); 00135 } 00136 00138 void set_cache_flush_poll_interval_sec(int64 num_seconds) { 00139 set_option(num_seconds, &cache_flush_poll_interval_sec_); 00140 } 00141 int64 cache_flush_poll_interval_sec() const { 00142 return cache_flush_poll_interval_sec_.value(); 00143 } 00144 void set_cache_flush_filename(const StringPiece& sp) { 00145 set_option(sp.as_string(), &cache_flush_filename_); 00146 } 00147 const GoogleString& cache_flush_filename() const { 00148 return cache_flush_filename_.value(); 00149 } 00150 00152 virtual SystemRewriteOptions* Clone() const; 00153 00154 private: 00157 static Properties* system_properties_; 00158 00161 template<class RewriteOptionsSubclass, class OptionClass> 00162 static void AddSystemProperty(typename OptionClass::ValueType default_value, 00163 OptionClass RewriteOptionsSubclass::*offset, 00164 const char* id, 00165 OptionEnum option_enum, 00166 const char* help) { 00167 AddProperty(default_value, offset, id, option_enum, kServerScope, help, 00168 system_properties_); 00169 } 00170 00171 static void AddProperties(); 00172 00173 Option<GoogleString> fetcher_proxy_; 00174 Option<GoogleString> file_cache_path_; 00175 00178 Option<GoogleString> memcached_servers_; 00179 Option<GoogleString> statistics_logging_file_; 00180 Option<GoogleString> statistics_logging_charts_css_; 00181 Option<GoogleString> statistics_logging_charts_js_; 00182 Option<GoogleString> cache_flush_filename_; 00183 00184 Option<bool> statistics_enabled_; 00185 Option<bool> statistics_logging_enabled_; 00186 Option<bool> use_shared_mem_locking_; 00187 00188 Option<int> memcached_threads_; 00189 Option<int> memcached_timeout_us_; 00190 00191 Option<int64> file_cache_clean_inode_limit_; 00192 Option<int64> file_cache_clean_interval_ms_; 00193 Option<int64> file_cache_clean_size_kb_; 00194 Option<int64> lru_cache_byte_limit_; 00195 Option<int64> lru_cache_kb_per_process_; 00196 Option<int64> statistics_logging_interval_ms_; 00199 Option<int64> cache_flush_poll_interval_sec_; 00200 00201 DISALLOW_COPY_AND_ASSIGN(SystemRewriteOptions); 00202 }; 00203 00204 } 00205 00206 #endif ///< NET_INSTAWEB_SYSTEM_PUBLIC_SYSTEM_REWRITE_OPTIONS_H_