Global Variables
Overview
Problem: You need global variables which persist across Apex instantiations, users and sessions.
Solution: Create a List Custom Setting object which accepts Name Value pairs.
Implementation
The implementation requires two resources. The first is a List Custom Settings object called GlobalVariable__c and a utility class GlobalVariable. Test coverage is in the GlobalVariableTest class.
Example Usage
GlobalVariable.put('MyKey','My Value'); System.debug('Here is the value: ' + GlobalVariable.get('MyKey'));