/search.css" rel="stylesheet" type="text/css"/> /search.js">
00001 #ifndef DBICACHE_H 00002 #define DBICACHE_H 00003 00025 #include <list> 00026 #include <map> 00027 #include <iosfwd> 00028 #include <ostream> 00029 #include <string> 00030 using std::ostream; 00031 using std::string; 00032 00033 #include "DatabaseInterface/Dbi.h" 00034 00035 class Context; 00036 class DbiResult; 00037 class DbiTableProxyRegistry; 00038 class DbiTableProxy; 00039 class DbiValidityRec; 00040 00041 class DbiCache 00042 { 00043 public: 00044 00045 // Typedefs 00046 00047 typedef std::list<DbiResult*> ResultList_t; 00048 00049 // Constructors and destructors. 00050 00051 DbiCache(DbiTableProxy& qp, 00052 const string& tableName); 00053 virtual ~DbiCache(); 00054 00055 00056 // State testing member functions 00057 UInt_t GetMaxSize() const { return fMaxSize; } 00058 UInt_t GetCurSize() const { return fCurSize; } 00059 UInt_t GetNumAdopted() const { return fNumAdopted; } 00060 UInt_t GetNumReused() const { return fNumReused; } 00062 const DbiResult* Search(const Context& vc, 00063 const Dbi::SubSite& subsite, 00064 const Dbi::Task& task) const; 00065 const DbiResult* Search(const string& sqlQualifiers) const; 00066 00068 const DbiResult* Search(const DbiValidityRec& vr, 00069 const string& sqlQualifiers = "") const; 00070 ostream& ShowStatistics(ostream& msg) const; 00071 00072 // State changing member functions 00073 void Adopt(DbiResult* res,bool registerKey = true); 00074 void Purge(); 00075 void SetStale(); 00076 00077 protected: 00078 00079 // State testing member functions 00080 00081 // State changing member functions 00082 00083 private: 00084 00085 // Disabled (not implemented) copy constructor and asignment. 00086 DbiCache(const DbiCache&); 00087 DbiCache& operator=(const DbiCache&); 00088 00089 const ResultList_t* GetSubCache(Int_t aggNo) const; 00090 void Purge(ResultList_t& subCache, const DbiResult* res=0); 00091 00092 // Data members 00093 00094 00096 DbiTableProxy& fTableProxy; 00097 00099 const string& fTableName; 00100 00104 std::map<Int_t,ResultList_t> fCache; 00105 00107 mutable UInt_t fCurSize; 00108 00110 mutable UInt_t fMaxSize; 00111 00113 mutable UInt_t fNumAdopted; 00114 00116 mutable UInt_t fNumReused; 00117 00118 00119 // Removed: ClassDef(DbiCache,0) //Query result cache for specific database table. 00120 00121 }; 00122 00123 00124 #endif // DBICACHE_H