async function getEntityContext(pid, fun = _ => _) {
				EntCache[pid] = new Volatile({});
				await EntCache[pid].lock((_entityContext) => {
					return new Promise((res, _rej) => {
						cacheInterface.getEntityPar(pid, (err, data) => {
							let par = JSON.parse(data.toString());
							if (err) {
								log.e(`Error retrieving a ${data.moduleType} from cache. Pid: ${pid}`);
								log.e(err);
								fun('Unavailable');
								return;
							}
							let impkey = par.Module + '/' + par.Entity;
							if (impkey in ImpCache) {
								BuildEnt();
								return;
							}

							GetModule(par.Module, async function (err, mod) {
								if (err) {
									log.e('Module <' + par.Module + '> not available');
									fun('Module not available');
									return;
								}

								if (!(par.Entity in mod.files)) {
									log.e('<' + par.Entity + '> not in module <' + par.Module + '>');
									fun('Null entity');
									return;
								}

								let entString = await new Promise(async (res, _rej) => {
									mod.file(par.Entity).async('string').then((string) => res(string));
								});

								log.v(`Spinning up entity ${par.Module}-${par.Entity.split('.')[0]}`);
								ImpCache[impkey] = indirectEvalImp(impkey, entString, log, 
									createRequireFromModuleType(par.Module));
								BuildEnt();
							});

							function BuildEnt() {
								// TODO: rethink the whole process of having to call out a setup and start
								res(new Entity(Nxs, ImpCache[impkey], par, log));

							}
						});
					});
				});
				fun(null, EntCache[pid]);
			}
async function getEntityContext(pid, fun = _ => _) {
				EntCache[pid] = new Volatile({});
				await EntCache[pid].lock((_entityContext) => {
					return new Promise((res, _rej) => {
						cacheInterface.getEntityPar(pid, (err, data) => {
							let par = JSON.parse(data.toString());
							if (err) {
								log.e(`Error retrieving a ${data.moduleType} from cache. Pid: ${pid}`);
								log.e(err);
								fun('Unavailable');
								return;
							}
							let impkey = par.Module + '/' + par.Entity;
							if (impkey in ImpCache) {
								BuildEnt();
								return;
							}

							GetModule(par.Module, async function (err, mod) {
								if (err) {
									log.e('Module <' + par.Module + '> not available');
									fun('Module not available');
									return;
								}

								if (!(par.Entity in mod.files)) {
									log.e('<' + par.Entity + '> not in module <' + par.Module + '>');
									fun('Null entity');
									return;
								}

								let entString = await new Promise(async (res, _rej) => {
									mod.file(par.Entity).async('string').then((string) => res(string));
								});

								log.v(`Spinning up entity ${par.Module}-${par.Entity.split('.')[0]}`);
								ImpCache[impkey] = indirectEvalImp(impkey, entString, log, 
									createRequireFromModuleType(par.Module));
								BuildEnt();
							});

							function BuildEnt() {
								// TODO: rethink the whole process of having to call out a setup and start
								res(new Entity(Nxs, ImpCache[impkey], par, log));

							}
						});
					});
				});
				fun(null, EntCache[pid]);
			}
async function getEntityContext ( pid , fun = _ => _ ) { EntCache [ pid ] = new Volatile ( { } ) ; await EntCache [ pid ] . lock ( ( _entityContext ) => { return new Promise ( ( res , _rej ) => { cacheInterface . getEntityPar ( pid , ( err , data ) => { let par = JSON . parse ( data . toString ( ) ) ; if ( err ) { log . e ( ` ${ data . moduleType } ${ pid } ` ) ; log . e ( err ) ; fun ( 'Unavailable' ) ; return ; } let impkey = par . Module + '/' + par . Entity ; if ( impkey in ImpCache ) { BuildEnt ( ) ; return ; } GetModule ( par . Module , async function ( err , mod ) { if ( err ) { log . e ( 'Module <' + par . Module + '> not available' ) ; fun ( 'Module not available' ) ; return ; } if ( ! ( par . Entity in mod . files ) ) { log . e ( '<' + par . Entity + '> not in module <' + par . Module + '>' ) ; fun ( 'Null entity' ) ; return ; } let entString = await new Promise ( async ( res , _rej ) => { mod . file ( par . Entity ) . async ( 'string' ) . then ( ( string ) => res ( string ) ) ; } ) ; log . v ( ` ${ par . Module } ${ par . Entity . split ( '.' ) [ 0 ] } ` ) ; ImpCache [ impkey ] = indirectEvalImp ( impkey , entString , log , createRequireFromModuleType ( par . Module ) ) ; BuildEnt ( ) ; } ) ; function BuildEnt ( ) { // TODO: rethink the whole process of having to call out a setup and start res ( new Entity ( Nxs , ImpCache [ impkey ] , par , log ) ) ; } } ) ; } ) ; } ) ; fun ( null , EntCache [ pid ] ) ; }
Spin up an entity from cache into memory and retrievd its context
otherwise just return it's context from memory
@param {string} apx 		the pid of the entities apex
@param {string} pid 		the pid of the entity
@callback fun  			the callback to return the pid of the generated entity to
Spin up an entity from cache into memory and retrievd its context otherwise just return it s context from memory