function addToCache(msg, node) {
    if (mod.RED === null) return
    if (node.cacheKey === undefined) return

    const cacheKey = node.cacheKey

    // If msg[<cacheKey>] doesn't exist (or is an empty string), do not process
    if ( !msg[cacheKey] ) return

    const cacheKeyValue = msg[cacheKey]

    // If this is a new property value in the stored variable, create empty array
    if ( !node.cache[cacheKeyValue] ) node.cache[cacheKeyValue] = []

    // HAS to be a CLONE to avoid downstream changes impacting cache
    const clone = mod.RED.util.cloneMessage(msg)
    delete clone._msgid

    // Add a new entry to the array
    node.cache[cacheKeyValue].push(clone)

    // See if the array is now too long - if so, slice it down to size (unless num=0)
    if ( node.num !== 0 && node.cache[cacheKeyValue].length > node.num ) {
        node.cache[cacheKeyValue] = node.cache[cacheKeyValue].slice( node.cache[cacheKeyValue].length - node.num )
    }

    // Save the cache
    node.setC(node.varName, node.cache, node.storeName)

    setNodeStatus(node)
}
Add a new msg to the cache, dropping excessive entries if needed
@param {*} msg The recieved message to add
@param {runtimeNode & cacheNode} node Reference to node instance