From 1dcc1b1fc9fd35d959255452c8b5be1269ca4f44 Mon Sep 17 00:00:00 2001 From: zecke Date: Thu, 10 Oct 2002 17:08:58 +0000 Subject: The Cache is finally in place I tested it with my todolist and it 'works' for 10.000 todos the hits are awesome ;) The read ahead functionality does not make sense for XMLs backends because most of the stuff is already in memory. While using readahead on SQL makes things a lot faster.... I still have to fully implement read ahead This change is bic but sc --- (limited to 'libopie/pim/opimaccessbackend.h') diff --git a/libopie/pim/opimaccessbackend.h b/libopie/pim/opimaccessbackend.h index c27acbb..27d3cb8 100644 --- a/libopie/pim/opimaccessbackend.h +++ b/libopie/pim/opimaccessbackend.h @@ -3,6 +3,7 @@ #include +#include #include @@ -17,6 +18,7 @@ template class OPimAccessBackend { public: + typedef OTemplateBase Frontend; OPimAccessBackend(); virtual ~OPimAccessBackend(); @@ -54,6 +56,8 @@ public: */ virtual T find(int uid )const = 0; + virtual T find(int uid, const QArray& items, + uint current, Frontend::CacheDirection )const ; /** * clear the back end */ @@ -74,16 +78,50 @@ public: */ virtual bool replace( const T& t ) = 0; + /* + * setTheFrontEnd!!! + */ + void setFrontend( Frontend* front ); + +protected: + void cache( const T& t )const; + + /** + * use a prime number here! + */ + void setSaneCacheSize( int ); + +private: + Frontend* m_front; }; template OPimAccessBackend::OPimAccessBackend() { - + m_front = 0l; } template OPimAccessBackend::~OPimAccessBackend() { } +template +void OPimAccessBackend::setFrontend( Frontend* fr ) { + m_front = fr; +} +template +void OPimAccessBackend::cache( const T& t )const { + if (m_front ) + m_front->cache( t ); +} +template +void OPimAccessBackend::setSaneCacheSize( int size) { + if (m_front ) + m_front->setSaneCacheSize( size ); +} +template +T OPimAccessBackend::find( int uid, const QArray&, + uint, Frontend::CacheDirection )const { + return find( uid ); +} #endif -- cgit v0.9.0.2