digraph G {


// Session ID
A0[label="Get session ID"]

subgraph cluster_A {
label="Critical section"
style=dotted
labeljust="r"

A[label="Create cache[ID][shape]"]
A1[shape=diamond,label="cache[ID] exists?"]
A2[label="Create cache[ID]"]
A3[label="Get cache[ID]"]
A4[shape=diamond,label="cache[ID][shape] exists?"]
A5[label="Get cache[ID][shape]"]

B[shape=diamond,label="Clear cache mode?"]
B1[shape=diamond,label="cache[ID][shape][name] exists?"]
B2[label="Create cache[ID][shape][name]"]
B3[label="Get cache[ID][shape][name]"]
B4[label="assign data to cache[ID][shape][name]"]
D[shape=diamond,label="Cache full?"]
F[label="Erase cache[ID][oldest shape]"]
}

A0 -> A1 [label="ID"]
A1 -> A2 [label="no"]
A1 -> A3 [label="yes"]
A2 -> A3
A3 -> A4
A4 -> B  [label="no"]
A -> A5
A4 -> A5 [label="yes"]

// Shape
// Get blob
B -> A [label="no"]
B -> D [label="yes"]

D -> A [label="no"]
D -> F [label="yes"]
F -> A


A5 -> B1
B1 -> B2 [label="no"]
B2 -> B3
B1 -> B3 [label="yes"]
B3 -> B4

}
