Page Speed Optimization Libraries  1.5.27.2
net/instaweb/system/public/system_cache_path.h
Go to the documentation of this file.
00001 // Copyright 2011 Google Inc.
00016 
00017 #ifndef NET_INSTAWEB_SYSTEM_PUBLIC_SYSTEM_CACHE_PATH_H_
00018 #define NET_INSTAWEB_SYSTEM_PUBLIC_SYSTEM_CACHE_PATH_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 AbstractSharedMem;
00027 class CacheInterface;
00028 class FileCache;
00029 class FileSystemLockManager;
00030 class MessageHandler;
00031 class NamedLockManager;
00032 class RewriteDriverFactory;
00033 class SharedMemLockManager;
00034 class SlowWorker;
00035 class SystemRewriteOptions;
00036 
00040 class SystemCachePath {
00041  public:
00043   static const char kFileCache[];
00044   static const char kLruCache[];
00045 
00046   SystemCachePath(const StringPiece& path,
00047                   const SystemRewriteOptions* config,
00048                   RewriteDriverFactory* factory,
00049                   AbstractSharedMem* shm_runtime);
00050   ~SystemCachePath();
00051 
00053   CacheInterface* lru_cache() { return lru_cache_; }
00054 
00056   CacheInterface* file_cache() { return file_cache_; }
00057 
00058   NamedLockManager* lock_manager() { return lock_manager_; }
00059 
00061   void RootInit();
00062   void ChildInit(SlowWorker* cache_clean_worker);
00063   void GlobalCleanup(MessageHandler* handler); 
00064 
00065  private:
00066   void FallBackToFileBasedLocking();
00067   GoogleString LockManagerSegmentName() const;
00068 
00069   GoogleString path_;
00070 
00071   RewriteDriverFactory* factory_;
00072   AbstractSharedMem* shm_runtime_;
00073   scoped_ptr<SharedMemLockManager> shared_mem_lock_manager_;
00074   scoped_ptr<FileSystemLockManager> file_system_lock_manager_;
00075   NamedLockManager* lock_manager_;
00076   FileCache* file_cache_backend_; 
00077   CacheInterface* lru_cache_;
00078   CacheInterface* file_cache_;
00079 };
00080 
00084 #define CACHE_STATISTICS 1
00085 
00086 }  
00087 
00088 #endif  ///< NET_INSTAWEB_SYSTEM_PUBLIC_SYSTEM_CACHE_PATH_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines