mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 08:29:26 -05:00
simplified the remoteDirModel cache system a little bie
This commit is contained in:
parent
644c41e2e7
commit
61131e4bf5
@ -56,7 +56,7 @@ RetroshareDirModel::RetroshareDirModel(bool mode, QObject *parent)
|
||||
#endif
|
||||
treeStyle();
|
||||
|
||||
mLastPointer = (void*)intptr_t(0xffffffff) ;
|
||||
mDirDetails.ref = (void*)intptr_t(0xffffffff) ;
|
||||
mLastRemote = false ;
|
||||
}
|
||||
|
||||
@ -972,9 +972,9 @@ bool RetroshareDirModel::requestDirDetails(void *ref, bool remote,DirDetails& d)
|
||||
|
||||
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 ;
|
||||
}
|
||||
|
||||
@ -983,9 +983,8 @@ bool RetroshareDirModel::requestDirDetails(void *ref, bool remote,DirDetails& d)
|
||||
if(rsFiles->RequestDirDetails(ref, d, flags))
|
||||
{
|
||||
mLastReq = now ;
|
||||
mLastPointer = ref ;
|
||||
mLastRemote = remote ;
|
||||
mLastDirDetails = d;
|
||||
mDirDetails = d;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -153,8 +153,7 @@ class RetroshareDirModel : public QAbstractItemModel
|
||||
|
||||
// This material attempts to keep last request in cache, with no search cost.
|
||||
|
||||
mutable DirDetails mLastDirDetails ;
|
||||
mutable void *mLastPointer ;
|
||||
mutable DirDetails mDirDetails ;
|
||||
mutable bool mLastRemote ;
|
||||
mutable time_t mLastReq;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user