The key will be the relay globalID and store all db item data. When the node is recovered, the viewerCanSee will filter this.
postGlobalIDpostGlobalIDcommentGlobalID
{
"id": "globalID",
"_id": "mongoID",
"content": "build a cache with relay"
}The Key will concat the parent_id, query name, pagination info (first, after) and any possible other argument. At the end, the key will be parent_id::query::first::after::filters. The edge will store the cursor and a reference to the node.
root::posts::10::postGlobalIDmeGlobalID::posts::10::postGlobalIDroot::comments::10::commentGlobalID
{
"pageInfo": {},
"edges": [
{ "cursor": "postCursor", "node": "postGlobalID" },
{ "cursor": "postCursor", "node": "postGlobalID" },
{ "cursor": "postCursor", "node": "postGlobalID" }
]
}When a mutation is called, the key and all connections with this globalID reference will be invalidated. Also, a TTL could be defined to remove the key after some time.