00001 // Copyright 2011 Google Inc. 00016 00017 #ifndef NET_INSTAWEB_APACHE_APACHE_CACHE_H_ 00018 #define NET_INSTAWEB_APACHE_APACHE_CACHE_H_ 00019 00020 #include "base/scoped_ptr.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 ApacheConfig; 00028 class ApacheRewriteDriverFactory; 00029 class CacheInterface; 00030 class FileCache; 00031 class FileSystemLockManager; 00032 class Hasher; 00033 class HTTPCache; 00034 class MessageHandler; 00035 class NamedLockManager; 00036 class PropertyCache; 00037 class SharedMemRuntime; 00038 class SharedMemLockManager; 00039 class Timer; 00040 00044 class ApacheCache { 00045 public: 00046 ApacheCache(const StringPiece& path, 00047 const ApacheConfig& config, 00048 ApacheRewriteDriverFactory* factory); 00049 ~ApacheCache(); 00050 CacheInterface* cache() { return cache_.get(); } 00051 NamedLockManager* lock_manager() { return lock_manager_; } 00052 HTTPCache* http_cache() { return http_cache_.get(); } 00053 PropertyCache* page_property_cache() { 00054 return page_property_cache_.get(); 00055 } 00056 PropertyCache* client_property_cache() { 00057 return client_property_cache_.get(); 00058 } 00059 00060 void RootInit(); 00061 void ChildInit(); 00062 void GlobalCleanup(MessageHandler* handler); 00063 00064 private: 00065 void FallBackToFileBasedLocking(); 00066 00067 GoogleString path_; 00068 00069 ApacheRewriteDriverFactory* factory_; 00070 scoped_ptr<CacheInterface> cache_; 00071 scoped_ptr<SharedMemLockManager> shared_mem_lock_manager_; 00072 scoped_ptr<FileSystemLockManager> file_system_lock_manager_; 00073 NamedLockManager* lock_manager_; 00074 FileCache* file_cache_; 00075 scoped_ptr<HTTPCache> http_cache_; 00076 scoped_ptr<PropertyCache> page_property_cache_; 00077 scoped_ptr<PropertyCache> client_property_cache_; 00078 }; 00079 00080 } 00081 00082 #endif ///< NET_INSTAWEB_APACHE_APACHE_CACHE_H_