mirror of https://gitee.com/bigwinds/arangodb
Graph: Also refresh the cache if the rev is different
This commit is contained in:
parent
16328720d3
commit
3da8d973f9
|
@ -594,6 +594,14 @@ Graph.prototype._saveVertex = function (id, shallow, waitForSync) {
|
|||
return this.constructVertex(ref._id);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief replaces a vertex to the graph
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Graph.prototype._replaceVertex = function (vertex_id, data) {
|
||||
var result = this._vertices.replace(vertex_id, data);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns a vertex given its id
|
||||
///
|
||||
|
@ -825,17 +833,18 @@ Graph.prototype.setCachedPredecessors = function (target, source, value) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Graph.prototype.constructVertex = function (data) {
|
||||
var id;
|
||||
var id, rev;
|
||||
|
||||
if (typeof data === "string") {
|
||||
id = data;
|
||||
} else {
|
||||
id = data._id;
|
||||
rev = data._rev;
|
||||
}
|
||||
|
||||
var vertex = this._verticesCache[id];
|
||||
|
||||
if (vertex === undefined) {
|
||||
if (vertex === undefined || vertex._rev !== rev) {
|
||||
var properties = this._vertices.document(id);
|
||||
|
||||
if (! properties) {
|
||||
|
@ -859,11 +868,12 @@ Graph.prototype.constructEdge = function (data) {
|
|||
id = data;
|
||||
} else {
|
||||
id = data._id;
|
||||
rev = data._rev;
|
||||
}
|
||||
|
||||
edge = this._edgesCache[id];
|
||||
|
||||
if (edge === undefined) {
|
||||
if (edge === undefined || edge._rev !== rev) {
|
||||
properties = this._edges.document(id);
|
||||
|
||||
if (!properties) {
|
||||
|
|
Loading…
Reference in New Issue