-rw-r--r-- | libopie2/opiepim/backend/opimaccessbackend.h | 16 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccesssql.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimaccesstemplate.h | 5 |
3 files changed, 21 insertions, 2 deletions
diff --git a/libopie2/opiepim/backend/opimaccessbackend.h b/libopie2/opiepim/backend/opimaccessbackend.h index 27d3cb8..0bd2723 100644 --- a/libopie2/opiepim/backend/opimaccessbackend.h +++ b/libopie2/opiepim/backend/opimaccessbackend.h @@ -83,6 +83,10 @@ public: */ void setFrontend( Frontend* front ); + /** + * set the read ahead count + */ + void setReadAhead( uint count ); protected: void cache( const T& t )const; @@ -91,8 +95,11 @@ protected: */ void setSaneCacheSize( int ); + uint readAhead()const; + private: Frontend* m_front; + uint m_read; }; @@ -123,5 +130,12 @@ T OPimAccessBackend<T>::find( int uid, const QArray<int>&, uint, Frontend::CacheDirection )const { return find( uid ); } - +template <class T> +void OPimAccessBackend<T>::setReadAhead( uint count ) { + m_read = count; +} +template <class T> +uint OPimAccessBackend<T>::readAhead()const { + return m_read; +} #endif diff --git a/libopie2/opiepim/backend/otodoaccesssql.cpp b/libopie2/opiepim/backend/otodoaccesssql.cpp index 9ef6b7c..8c2ea3a 100644 --- a/libopie2/opiepim/backend/otodoaccesssql.cpp +++ b/libopie2/opiepim/backend/otodoaccesssql.cpp @@ -286,9 +286,9 @@ OTodo OTodoAccessBackendSQL::find(int uid ) const{ return todo( m_driver->query(&query) ); } -#define CACHE 32 OTodo OTodoAccessBackendSQL::find( int uid, const QArray<int>& ints, uint cur, Frontend::CacheDirection dir ) const{ + int CACHE = readAhead(); qWarning("searching for %d", uid ); QArray<int> search( CACHE ); uint size =0; diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h index 50cb1e4..c5523a8 100644 --- a/libopie2/opiepim/core/opimaccesstemplate.h +++ b/libopie2/opiepim/core/opimaccesstemplate.h @@ -116,6 +116,7 @@ public: */ virtual bool replace( const T& t) ; + void setReadAhead( uint count ); /** * @internal */ @@ -251,4 +252,8 @@ template <class T> void OPimAccessTemplate<T>::setSaneCacheSize( int size ) { m_cache.setSize( size ); } +template <class T> +void OPimAccessTemplate<T>::setReadAhead( uint count ) { + m_backEnd->setReadAhead( count ); +} #endif |