mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-28 00:49:28 -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
|
#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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user