I would like to use the knownServerRevision parameter when perfoming the .Refresh method of the ClientInstance. The only problem is, where can I get the value for the last knownServerRevision for the local cache?
Thanks,
Dave King
Vault API question: knownServerRevision param for .Refresh
Moderator: SourceGear
You almost always want to set knownServerRevision to -1 when calling ClientInstance.Refresh(). The purpose of this parameter is to allow the Refresh call to skip the network hit if knownServerRevision is the revision the tree cache is already at, if the value you passed was not -1. You would only pass in a different value if you had just previously found out the latest version of the repository tree (through some other communications with the server) and wanted to keep network traffic to an absolute minimum.
Shaw Terwilliger
SourceGear LLC
`echo sterwill5sourcegear6com | tr 56 @.`
SourceGear LLC
`echo sterwill5sourcegear6com | tr 56 @.`
Won't a value of -1 hit the server every time?
I DO want to keep network traffic to a minimum. That's what I'm trying to figure out. Refresh seems to send the server tree data even if my cache is up to date. What I'm trying to determine is how to avoid this. How do I determine the version of my local cache so that I only fetch data when necessary?
I don't think the problem you're trying to solve is related to this parameter. If a tree delta is being transferred even when you're up-to-date, it's probably a different problem. Do you have a large number of shared items in the repository? Refresh must contact the server every time it's called, or else it can't ever determine whether the server has newer data.
A bit of history on the knownServerRevision parameter:
This parameter is for when you know the server's most recent version of the repository, not your local client's version. The Refresh function that takes knownServerRevision is mostly useless, and it's not used by any modern Vault clients. It was originally written to let clients call Refresh more often right after they've logged in (when they learn the latest repository version from GetRepositoryList). It will be removed in a future release of Vault, because the design pattern wasn't found to be useful.
If you want to know what your local tree cache's version is, you can simple read clientInstance.Repository.RevID.
A bit of history on the knownServerRevision parameter:
This parameter is for when you know the server's most recent version of the repository, not your local client's version. The Refresh function that takes knownServerRevision is mostly useless, and it's not used by any modern Vault clients. It was originally written to let clients call Refresh more often right after they've logged in (when they learn the latest repository version from GetRepositoryList). It will be removed in a future release of Vault, because the design pattern wasn't found to be useful.
If you want to know what your local tree cache's version is, you can simple read clientInstance.Repository.RevID.
Shaw Terwilliger
SourceGear LLC
`echo sterwill5sourcegear6com | tr 56 @.`
SourceGear LLC
`echo sterwill5sourcegear6com | tr 56 @.`