Page Speed Optimization Libraries  1.2.24.1
net/instaweb/apache/apache_cache.h
Go to the documentation of this file.
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 "net/instaweb/util/public/scoped_ptr.h"
00021 #include "net/instaweb/util/public/string.h"
00022 #include "net/instaweb/util/public/string_util.h"
00023 
00024 namespace net_instaweb {
00025 
00026 class ApacheConfig;
00027 class ApacheRewriteDriverFactory;
00028 class CacheInterface;
00029 class FileCache;
00030 class FileSystemLockManager;
00031 class MessageHandler;
00032 class NamedLockManager;
00033 class SharedMemLockManager;
00034 
00038 class ApacheCache {
00039  public:
00040   static const char kFileCache[];
00041   static const char kLruCache[];
00042 
00043   ApacheCache(const StringPiece& path,
00044               const ApacheConfig& config,
00045               ApacheRewriteDriverFactory* factory);
00046   ~ApacheCache();
00047   CacheInterface* l1_cache() { return l1_cache_.get(); }
00048   CacheInterface* l2_cache() { return l2_cache_.get(); }
00049   NamedLockManager* lock_manager() { return lock_manager_; }
00050 
00051   void RootInit();
00052   void ChildInit();
00053   void GlobalCleanup(MessageHandler* handler); 
00054 
00055  private:
00056   void FallBackToFileBasedLocking();
00057 
00058   GoogleString path_;
00059 
00060   ApacheRewriteDriverFactory* factory_;
00061   scoped_ptr<SharedMemLockManager> shared_mem_lock_manager_;
00062   scoped_ptr<FileSystemLockManager> file_system_lock_manager_;
00063   NamedLockManager* lock_manager_;
00064   FileCache* file_cache_; 
00065   scoped_ptr<CacheInterface> l1_cache_;
00066   scoped_ptr<CacheInterface> l2_cache_;
00067 };
00068 
00072 #define CACHE_STATISTICS 1
00073 
00074 }  
00075 
00076 #endif  ///< NET_INSTAWEB_APACHE_APACHE_CACHE_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines