cache-min.js revision be59865ef8ef61e2d370aba9cbded2e2b7ccbc8b
YUI.add("cache",function(C){var A=C.Lang,B=function(){B.superclass.constructor.apply(this,arguments);};C.mix(B,{NAME:"cache",ATTRS:{size:{value:0,validator:function(D){return(A.isNumber(D));},setter:function(E){var D=this._entries;if(E>0){if(D){while(D.length>E){D.shift();}}}else{this._entries=[];}return E;}}}});C.extend(B,C.Base,{_entries:null,initializer:function(){this.publish("add",{defaultFn:this._defAddFn});this.publish("flush",{defaultFn:this._defFlushFn});this._entries=[];},destructor:function(){this._entries=null;},_defAddFn:function(G,F){var E=this._entries,D=this.get("size");if(!E||(D<=0)){G.stopImmediatePropagation();return;}while(E.length>=(D)){E.shift();}E[E.length]=F;},_defFlushFn:function(D){this._entries=[];},getEntries:function(){return this._entries;},isMatch:function(E,D){return(E===D.request);},add:function(E,D,F){if(A.isValue(E)&&A.isValue(D)){this.fire("add",null,{request:E,response:D,payload:F});}else{}},flush:function(){this.fire("flush");},retrieve:function(H){var D=this._entries,G=D.length,F=null,E=G-1;if((this.get("size")>0)&&(G>0)){this.fire("request",null,H);for(;E>=0;E--){F=D[E];if(this.isMatch(H,F)){this.fire("retrieve",null,F);if(E<G-1){D.splice(E,1);D[D.length]=F;break;}}}return F;}return null;}});C.namespace("Cache");C.Cache=B;},"@VERSION@",{requires:["base"]});