simplified the remoteDirModel cache system a little bie

This commit is contained in:
csoler 2016-11-08 19:56:07 +01:00
parent 644c41e2e7
commit 61131e4bf5
2 changed files with 5 additions and 7 deletions

View File

@ -56,7 +56,7 @@ RetroshareDirModel::RetroshareDirModel(bool mode, QObject *parent)
#endif #endif
treeStyle(); treeStyle();
mLastPointer = (void*)intptr_t(0xffffffff) ; mDirDetails.ref = (void*)intptr_t(0xffffffff) ;
mLastRemote = false ; mLastRemote = false ;
} }
@ -972,9 +972,9 @@ bool RetroshareDirModel::requestDirDetails(void *ref, bool remote,DirDetails& d)
time_t now = time(NULL); time_t now = time(NULL);
if(mLastPointer == ref && mLastRemote==remote && now < 2+mLastReq) if(mDirDetails.ref == ref && mLastRemote==remote && now < 2+mLastReq)
{ {
d = mLastDirDetails ; d = mDirDetails ;
return true ; return true ;
} }
@ -983,9 +983,8 @@ bool RetroshareDirModel::requestDirDetails(void *ref, bool remote,DirDetails& d)
if(rsFiles->RequestDirDetails(ref, d, flags)) if(rsFiles->RequestDirDetails(ref, d, flags))
{ {
mLastReq = now ; mLastReq = now ;
mLastPointer = ref ;
mLastRemote = remote ; mLastRemote = remote ;
mLastDirDetails = d; mDirDetails = d;
return true; return true;
} }

View File

@ -153,8 +153,7 @@ class RetroshareDirModel : public QAbstractItemModel
// This material attempts to keep last request in cache, with no search cost. // This material attempts to keep last request in cache, with no search cost.
mutable DirDetails mLastDirDetails ; mutable DirDetails mDirDetails ;
mutable void *mLastPointer ;
mutable bool mLastRemote ; mutable bool mLastRemote ;
mutable time_t mLastReq; mutable time_t mLastReq;
}; };