I’m grateful to reader ‘Legend’ who suggested that I use a JavaScript object as a cache rather than a set of variables. So my cache would look like this:
var cache = new Object(); cache['cmi.core.lesson_location'] = ''; cache['cmi.core.credit'] = ''; cache['cmi.core.lesson_status'] = ''; cache['cmi.core.entry'] = ''; cache['cmi.core.exit'] = ''; cache['cmi.core.total_time'] = ''; cache['cmi.core.session_time'] = ''; cache['cmi.suspend_data'] = ''; cache['cmi.launch_data'] = ''; cache['adlcp:masteryscore'] = ''; cache['cmi.core.score.raw'] = ''; cache['cmi.core.student_id'] = ''; cache['cmi.core.student_name'] = ''; cache['cmi.core._children'] = ''; cache['cmi.core.score._children'] = '';
This is what I – being brought up on perl and then PHP – would think of as an ‘associative array’. And it’s going to be MUCH easier to manage than my previous way of doing things – no need to translate the variable names. So please ignore my previous post.
Next time – modifying the LMSSetValue() and LMSGetValue() API calls to interact with the cache.