一个简单的JavaScript数据缓存系统实现代码

时间:2010-10-24    点击:105   
复制代码 代码如下:

var DataCache = function(){
if(!(this instanceof DataCache)){
return new DataCache();
}
this.id = 0;
this.caches = {};
};
DataCache.prototype = {
add : function(val){
val = val || null;
key = "dc_" + this.id;

this.caches[key] = val;
return key;
},
remove : function(key){
delete this.caches[key];
},
get : function(key){
return this.caches[key];
},
set : function(key,val){
this.caches[key] = val;
}
};
Dom 是什么的详细说明
Javascript类库的顶层对象名用户体验分析
让ie运行js时提示允许阻止内容运行的解决方法
javascript 隔行换色函数代码
JavaScript类库D
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved