
(function($){
	
	 $.fn.cache = function(options) {
	 };
 
	$.fn.cache.get = function(key, namespace) 
	{
		var spaceVal = getNamespace(namespace);
		return spaceVal[key];
  	};
  	$.fn.cache.set = function(key, value, namespace) 
	{
		var spaceVal = getNamespace(namespace);
		spaceVal[key] = value;
		setNamespace(spaceVal, namespace);
  	};
  	$.fn.cache.remove = function(key, namespace) 
	{
		var spaceVal = getNamespace(namespace);
		if(spaceVal[key])
		{
			spaceVal[key] = undefined;
			delete spaceVal[key];
		}
		
		setNamespace(spaceVal, namespace);
  	};
  	$.fn.cache.removeNamespace = function(namespace) 
	{
		if(!namespace)
		{
			namespace = 'default';
		}
		
		$("body").removeData(namespace);
  	};
	function getNamespace(namespace) 
	{
		if(!namespace)
		{
			namespace = 'default';
		}
		
		return $("body").data(namespace) == undefined ? {} : $("body").data(namespace);
	};
	function setNamespace(spaceVal, namespace) 
	{
		if(!namespace)
		{
			namespace = 'default';
		}
		
		$("body").removeData(namespace);
		$("body").data(namespace, spaceVal);
	};
 
})(jQuery);

