 		private var delete_later:Object = {}; // id -> Boolean
 		private var _dataTableIds:Array = []; // array of EntityTableInfo
 		private var _dataTableLookup:Object = {}; // id -> EntityTableInfo
+		private var pending_invalidate:Object = {}; // id -> Boolean; used to remember which ids to invalidate the next time the entity is requested
 		
         public function EntityCache()
         {

        
		public function clearCache():void
        {
			//TODO: clearCache() still causes full data table metadata to be requested
			
			callbacks.delayCallbacks();
			
			// we don't want to delete the cache because we can still use the cached values for display in the meantime.
			for (var id:* in cache_entity)
				invalidate(id);
			
			callbacks.triggerCallbacks();
			

			if (!cache_dirty[id])
				callbacks.triggerCallbacks();
			
			pending_invalidate[id] = false;
			cache_dirty[id] = true;
			
			if (!cache_entity[id])
