Page Speed Optimization Libraries
1.3.25.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 00027 class Hasher; 00028 00031 class SystemRewriteOptions : public RewriteOptions { 00032 public: 00033 static void Initialize(); 00034 static void Terminate(); 00035 00036 SystemRewriteOptions(); 00037 virtual ~SystemRewriteOptions(); 00038 00039 int64 file_cache_clean_interval_ms() const { 00040 return file_cache_clean_interval_ms_.value(); 00041 } 00042 void set_file_cache_clean_interval_ms(int64 x) { 00043 set_option(x, &file_cache_clean_interval_ms_); 00044 } 00045 int64 file_cache_clean_size_kb() const { 00046 return file_cache_clean_size_kb_.value(); 00047 } 00048 void set_file_cache_clean_size_kb(int64 x) { 00049 set_option(x, &file_cache_clean_size_kb_); 00050 } 00051 int64 file_cache_clean_inode_limit() const { 00052 return file_cache_clean_inode_limit_.value(); 00053 } 00054 void set_file_cache_clean_inode_limit(int64 x) { 00055 set_option(x, &file_cache_clean_inode_limit_); 00056 } 00057 int64 lru_cache_byte_limit() const { 00058 return lru_cache_byte_limit_.value(); 00059 } 00060 void set_lru_cache_byte_limit(int64 x) { 00061 set_option(x, &lru_cache_byte_limit_); 00062 } 00063 int64 lru_cache_kb_per_process() const { 00064 return lru_cache_kb_per_process_.value(); 00065 } 00066 void set_lru_cache_kb_per_process(int64 x) { 00067 set_option(x, &lru_cache_kb_per_process_); 00068 } 00069 bool use_shared_mem_locking() const { 00070 return use_shared_mem_locking_.value(); 00071 } 00072 void set_use_shared_mem_locking(bool x) { 00073 set_option(x, &use_shared_mem_locking_); 00074 } 00075 const GoogleString& use_shared_mem_metadata_cache() const { 00076 return use_shared_mem_metadata_cache_.value(); 00077 } 00078 bool statistics_enabled() const { 00079 return statistics_enabled_.value(); 00080 } 00081 void set_statistics_enabled(bool x) { 00082 set_option(x, &statistics_enabled_); 00083 } 00084 bool statistics_logging_enabled() const { 00085 return statistics_logging_enabled_.value(); 00086 } 00087 void set_statistics_logging_enabled(bool x) { 00088 set_option(x, &statistics_logging_enabled_); 00089 } 00090 const GoogleString& statistics_logging_file() const { 00091 return statistics_logging_file_.value(); 00092 } 00093 const GoogleString& statistics_logging_charts_css() const { 00094 return statistics_logging_charts_css_.value(); 00095 } 00096 const GoogleString& statistics_logging_charts_js() const { 00097 return statistics_logging_charts_js_.value(); 00098 } 00099 void set_statistics_logging_file(GoogleString x) { 00100 set_option(x, &statistics_logging_file_); 00101 } 00102 int64 statistics_logging_interval_ms() const { 00103 return statistics_logging_interval_ms_.value(); 00104 } 00105 void set_statistics_logging_interval_ms(int64 x) { 00106 set_option(x, &statistics_logging_interval_ms_); 00107 } 00108 const GoogleString& file_cache_path() const { 00109 return file_cache_path_.value(); 00110 } 00111 void set_file_cache_path(GoogleString x) { 00112 set_option(x, &file_cache_path_); 00113 } 00114 const GoogleString& memcached_servers() const { 00115 return memcached_servers_.value(); 00116 } 00117 void set_memcached_servers(GoogleString x) { 00118 set_option(x, &memcached_servers_); 00119 } 00120 int memcached_threads() const { 00121 return memcached_threads_.value(); 00122 } 00123 void set_memcached_threads(int x) { 00124 set_option(x, &memcached_threads_); 00125 } 00126 int memcached_timeout_us() const { 00127 return memcached_timeout_us_.value(); 00128 } 00129 bool has_memcached_timeout_us() const { 00130 return memcached_timeout_us_.was_set(); 00131 } 00132 void set_memcached_timeout_us(int x) { 00133 set_option(x, &memcached_timeout_us_); 00134 } 00135 const GoogleString& fetcher_proxy() const { 00136 return fetcher_proxy_.value(); 00137 } 00138 void set_fetcher_proxy(GoogleString x) { 00139 set_option(x, &fetcher_proxy_); 00140 } 00141 00143 void set_cache_flush_poll_interval_sec(int64 num_seconds) { 00144 set_option(num_seconds, &cache_flush_poll_interval_sec_); 00145 } 00146 int64 cache_flush_poll_interval_sec() const { 00147 return cache_flush_poll_interval_sec_.value(); 00148 } 00149 void set_cache_flush_filename(const StringPiece& sp) { 00150 set_option(sp.as_string(), &cache_flush_filename_); 00151 } 00152 const GoogleString& cache_flush_filename() const { 00153 return cache_flush_filename_.value(); 00154 } 00155 00157 virtual SystemRewriteOptions* Clone() const; 00158 00159 private: 00162 static Properties* system_properties_; 00163 00170 template<class RewriteOptionsSubclass, class OptionClass> 00171 static void add_option(typename OptionClass::ValueType default_value, 00172 OptionClass RewriteOptionsSubclass::*offset, 00173 const char* id, 00174 OptionEnum option_enum) { 00175 AddProperty(default_value, offset, id, option_enum, system_properties_); 00176 } 00177 00178 static void AddProperties(); 00179 00180 Option<GoogleString> fetcher_proxy_; 00181 Option<GoogleString> file_cache_path_; 00182 00185 Option<GoogleString> memcached_servers_; 00186 Option<GoogleString> statistics_logging_file_; 00187 Option<GoogleString> statistics_logging_charts_css_; 00188 Option<GoogleString> statistics_logging_charts_js_; 00189 Option<GoogleString> cache_flush_filename_; 00190 00193 Option<GoogleString> use_shared_mem_metadata_cache_; 00194 00195 Option<bool> statistics_enabled_; 00196 Option<bool> statistics_logging_enabled_; 00197 Option<bool> use_shared_mem_locking_; 00198 00199 Option<int> memcached_threads_; 00200 Option<int> memcached_timeout_us_; 00201 00202 Option<int64> file_cache_clean_inode_limit_; 00203 Option<int64> file_cache_clean_interval_ms_; 00204 Option<int64> file_cache_clean_size_kb_; 00205 Option<int64> lru_cache_byte_limit_; 00206 Option<int64> lru_cache_kb_per_process_; 00207 Option<int64> statistics_logging_interval_ms_; 00210 Option<int64> cache_flush_poll_interval_sec_; 00211 00212 DISALLOW_COPY_AND_ASSIGN(SystemRewriteOptions); 00213 }; 00214 00215 } 00216 00217 #endif ///< NET_INSTAWEB_SYSTEM_PUBLIC_SYSTEM_REWRITE_OPTIONS_H_