#ifndef BU_CACHE_CALC_H #define BU_CACHE_CALC_H #include "bu/trace.h" #include namespace Bu { template class Cache; template class CacheCalc { friend class Cache; private: typedef Cache MyCache; public: CacheCalc() : pCache( (MyCache *)0 ) { TRACE(); } virtual ~CacheCalc() { TRACE(); } virtual void onLoad( obtype *pSrc, const keytype &key )=0; virtual void onUnload( obtype *pSrc, const keytype &key )=0; virtual bool shouldSync( obtype *pSrc, const keytype &key, time_t tLastSync )=0; virtual void onTick() { }; protected: MyCache *getCache() { TRACE(); return pCache; } private: void setCache( MyCache *pCache ) { TRACE(); this->pCache = pCache; } MyCache *pCache; }; }; #endif