2010年2月16日星期二

RE: [fw-mvc] zend_registry or zend_cache_manager

',HTMLParserUtils.TAG_SCRIPTCLOSE ],[ '',HTMLParserUtils.TAG_APPLETCLOSE ],[ '',HTMLParserUtils.TAG_TEXTAREACLOSE ],[ '',HTMLParserUtils.TAG_STYLECLOSE ],[ '',HTMLParserUtils.TAG_TEXTAREACLOSE ]];function make_match(){LexerJavaScriptTokenMatch['var']=JSParserUtils.JS_VAR;LexerJavaScriptTokenMatch['(']=JSParserUtils.JS_ROUNDOPEN;LexerJavaScriptTokenMatch[')']=JSParserUtils.JS_ROUNDCLOSE;LexerJavaScriptTokenMatch['{']=JSParserUtils.JS_CURLOPEN;LexerJavaScriptTokenMatch['}']=JSParserUtils.JS_CURLCLOSE;LexerJavaScriptTokenMatch['[']=JSParserUtils.JS_SQUAREOPEN;LexerJavaScriptTokenMatch[']']=JSParserUtils.JS_SQUARECLOSE;LexerJavaScriptTokenMatch['.']=JSParserUtils.JS_DOT;LexerJavaScriptTokenMatch['eval']=JSParserUtils.JS_EVAL;LexerJavaScriptTokenMatch['function']=JSParserUtils.JS_FUNCTION;LexerJavaScriptTokenMatch['with']=JSParserUtils.JS_WITH;LexerJavaScriptTokenMatch['break']=JSParserUtils.JS_RESERVEDWORD;LexerJavaScriptTokenMatch['case']=JSParserUtils.JS_RESERVEDWORD;LexerJavaScriptTokenMatch['catch']=JSParserUtils.JS_RESERVEDWORD;LexerJavaScriptTokenMatch['class']=JSParserUtils.JS_RESERVEDWORD;LexerJavaScriptTokenMatch['const']=JSParserUtils.JS_RESERVEDWORD;LexerJavaScriptTokenMatch['continue']=JSParserUtils.JS_RESERVEDWORD;LexerJavaScriptTokenMatch['debugger']=JSParserUtils.JS_RESERVEDWORD;LexerJavaScriptTokenMatch['debugger']=JSParserUtils.JS_RESERVEDWORD;LexerJavaScriptTokenMatch['delete']=JSParserUtils.JS_RESERVEDWORD;LexerJavaScriptTokenMatch['do']=JSParserUtils.JS_RESERVEDWORD;LexerJavaScriptTokenMatch['else']=JSParserUtils.JS_ELSE;LexerJavaScriptTokenMatch['export']=JSParserUtils.JS_RESERVEDWORD;LexerJavaScriptTokenMatch['extends']=JSParserUtils.JS_RESERVEDWORD;LexerJavaScriptTokenMatch['finally']=JSParserUtils.JS_RESERVEDWORD;LexerJavaScriptTokenMatch['for']=JSParserUtils.JS_RESERVEDWORD;LexerJavaScriptTokenMatch['import']=JSParserUtils.JS_RESERVEDWORD;LexerJavaScriptTokenMatch['in']=JSParserUtils.JS_RESERVEDWORD;LexerJavaScriptTokenMatch['instanceof']=JSParserUtils.JS_RESERVEDWORD;LexerJavaScriptTokenMatch['new']=JSParserUtils.JS_NEW;LexerJavaScriptTokenMatch['void']=JSParserUtils.JS_VOID;LexerJavaScriptTokenMatch['typeof']=JSParserUtils.JS_TYPEOF;LexerJavaScriptTokenMatch['protected']=JSParserUtils.JS_RESERVEDWORD;LexerJavaScriptTokenMatch['return']=JSParserUtils.JS_RETURN;LexerJavaScriptTokenMatch['super']=JSParserUtils.JS_RESERVEDWORD;LexerJavaScriptTokenMatch['switch']=JSParserUtils.JS_RESERVEDWORD;LexerJavaScriptTokenMatch['throw']=JSParserUtils.JS_RESERVEDWORD;LexerJavaScriptTokenMatch['try']=JSParserUtils.JS_RESERVEDWORD;LexerJavaScriptTokenMatch['++']=JSParserUtils.JS_UNOPERATION;LexerJavaScriptTokenMatch['==']=JSParserUtils.JS_COMPARISON;LexerJavaScriptTokenMatch['===']=JSParserUtils.JS_COMPARISON;LexerJavaScriptTokenMatch['!=']=JSParserUtils.JS_COMPARISON;LexerJavaScriptTokenMatch['!==']=JSParserUtils.JS_COMPARISON;LexerJavaScriptTokenMatch['>=']=JSParserUtils.JS_COMPARISON;LexerJavaScriptTokenMatch['<=']=JSParserUtils.JS_COMPARISON;LexerJavaScriptTokenMatch['>']=JSParserUtils.JS_COMPARISON;LexerJavaScriptTokenMatch['<']=JSParserUtils.JS_COMPARISON;LexerJavaScriptTokenMatch['+=']=JSParserUtils.JS_ASSIGNADD;LexerJavaScriptTokenMatch['%=']=JSParserUtils.JS_ASSIGNOP;LexerJavaScriptTokenMatch['&&=']=JSParserUtils.JS_ASSIGNOP;LexerJavaScriptTokenMatch['&=']=JSParserUtils.JS_ASSIGNOP;LexerJavaScriptTokenMatch['*=']=JSParserUtils.JS_ASSIGNOP;LexerJavaScriptTokenMatch['-=']=JSParserUtils.JS_ASSIGNOP;LexerJavaScriptTokenMatch['->']=JSParserUtils.JS_BINOPERATION;LexerJavaScriptTokenMatch['+']=JSParserUtils.JS_BINOPERATION;LexerJavaScriptTokenMatch['%']=JSParserUtils.JS_BINOPERATION;LexerJavaScriptTokenMatch['*']=JSParserUtils.JS_BINOPERATION;LexerJavaScriptTokenMatch['-']=JSParserUtils.JS_BINOPERATION;LexerJavaScriptTokenMatch['=']=JSParserUtils.JS_ASSIGN;LexerJavaScriptTokenMatch[';']=JSParserUtils.JS_SEMICOLON;LexerJavaScriptTokenMatch[',']=JSParserUtils.JS_COMMA;LexerJavaScriptTokenMatch['/']=JSParserUtils.JS_BINOPERATIONDIV;LexerJavaScriptTokenMatch['/=']=JSParserUtils.JS_ASSIGNDIV;LexerJavaScriptTokenMatch['^']=JSParserUtils.JS_BINOPERATION;LexerJavaScriptTokenMatch['^=']=JSParserUtils.JS_ASSIGNOP;LexerJavaScriptTokenMatch['#']=JSParserUtils.JS_BINOPERATION;LexerJavaScriptTokenMatch['&']=JSParserUtils.JS_BINOPERATION;LexerJavaScriptTokenMatch['&&']=JSParserUtils.JS_BINOPERATION;LexerJavaScriptTokenMatch['<<']=JSParserUtils.JS_BINOPERATION;LexerJavaScriptTokenMatch['>>']=JSParserUtils.JS_BINOPERATION;LexerJavaScriptTokenMatch['<<=']=JSParserUtils.JS_ASSIGNOP;LexerJavaScriptTokenMatch['>>=']=JSParserUtils.JS_ASSIGNOP;LexerJavaScriptTokenMatch['<=']=JSParserUtils.JS_ASSIGNOP;LexerJavaScriptTokenMatch['!']=JSParserUtils.JS_UNOPERATION;LexerJavaScriptTokenMatch['~']=JSParserUtils.JS_BINOPERATION;LexerJavaScriptTokenMatch['?']=JSParserUtils.JS_QUESTION;LexerJavaScriptTokenMatch[':']=JSParserUtils.JS_COLON;LexerJavaScriptTokenMatch['::']=JSParserUtils.JS_UNOPERATION;LexerJavaScriptTokenMatch['||=']=JSParserUtils.JS_ASSIGNOP;LexerJavaScriptTokenMatch['|=']=JSParserUtils.JS_ASSIGNOP;LexerJavaScriptTokenMatch['||']=JSParserUtils.JS_BINOPERATION;LexerJavaScriptTokenMatch['|']=JSParserUtils.JS_BINOPERATION;};function build_tag_gramm(){if(ParserWordsCall !=null){return;};ParserHtmlTags=new Array();ParserWordsCall=new Array();ParserWordsPut=new Array();ParserWordsGet=new Array();ParserWordsPutI=new Array();ParserWordsGetI=new Array();ParserWordsAllKeywords=new Array();ParserObjectType=new Object();ParserObjectFunc=new Object();LexerJavaScriptTokenMatch=new Object();make_match();ParserHtml['add_html_tags']();var tmp=new Array();for(var typeIndex in CSCO_wrapperStore){for(var actIndex in CSCO_wrapperStore[typeIndex]){for(var tagIndex in CSCO_wrapperStore[typeIndex][actIndex]){var arr=null;if(actIndex=='call'){arr=ParserWordsCall;ex='\\b'+tagIndex+'\\b';}else if(actIndex=='get'){arr=ParserWordsGet;ex='\\b'+tagIndex+'\\b';}else if(actIndex=='put'){arr=ParserWordsPut;ex='\\b'+tagIndex+'\\b';}else if(actIndex=='geti'){arr=ParserWordsGetI;tagIndex=tagIndex+'_i';ex='\\b'+tagIndex+'\\s*\\[[^]]*\\]';}else if(actIndex=='puti'){arr=ParserWordsPutI;tagIndex=tagIndex+'_i';ex='\\b'+tagIndex+'\\s*\\[[^]]*\\]';}else{};ParserWordsAllKeywords[tagIndex]=1;if('undefined'==typeof arr[tagIndex]){arr[tagIndex]=1;LexerJavaScriptTokenMatch[tagIndex]=tagIndex;tmp.push([ex,tagIndex,null]);};};};};ParserWordsCall["toString"]=1;ParserWordsAllKeywords["toString"]=1;LexerJavaScriptTokenMatch["toString"]="toString";tmp.push('\\btoString\\b');LexerJavaScript_gramm=tmp.concat(LexerJavaScript_gramm);for(var typeIndex in CSCO_wrapperStore){for(var actIndex in CSCO_wrapperStore[typeIndex]){for(var tagIndex in CSCO_wrapperStore[typeIndex][actIndex]){if("undefined"==typeof ParserObjectType[tagIndex]){ParserObjectType[tagIndex]=new Object();};ParserObjectType[tagIndex][typeIndex]=true;};};};ParserObjectType["toString"]["DOMELEMENT"]=true;if("undefined"==typeof ParserObjectType["csco_domain"]){ParserObjectType["csco_domain"]=new Object();};ParserObjectType["csco_domain"]["DOCUMENT"]=true;ParserObjectFunc["WINDOW"]="is_window";ParserObjectFunc["DOCUMENT"]="is_document";ParserObjectFunc["EXTERNAL"]="is_external";ParserObjectFunc["APPLET"]="is_applet";ParserObjectFunc["XMLHTTPOBJECT"]="is_httpxmlobject";ParserObjectFunc["NEWACTIVEXOBJECT"]="is_activexobject";ParserObjectFunc["OBJECT"]="is_object";ParserObjectFunc["EMBED"]="is_embed";ParserObjectFunc["DOMELEMENT"]="is_dom";ParserObjectFunc["LOCATION"]="is_location";ParserObjectFunc["HISTORY"]="is_history";ParserObjectFunc["CONTROLRANGE"]="is_controlrange";ParserObjectFunc["TEXTRANGE"]="is_textrange";ParserObjectFunc["STYLESHEET"]="is_stylesheet";ParserObjectFunc["NAMESPACE"]="is_namespace";ParserObjectFunc["LISTSTYLE"]="is_liststyle";ParserObjectFunc["XMLDOCUMENT"]="is_xmldocument";};function build_simple_test(){var arr=new Object();var tmp=new Array();var ex='';for(var typeIndex in CSCO_wrapperStore){for(var actIndex in CSCO_wrapperStore[typeIndex]){for(var tagIndex in CSCO_wrapperStore[typeIndex][actIndex]){ex='\\b'+tagIndex+'\\b';if('undefined'==typeof arr[tagIndex]){arr[tagIndex]=1;tmp.push(ex);};};};};tmp.push('\\beval\\b');tmp.push('\\bFunction\\b');tmp.push('String\\b');tmp.push('\\bwith\\b');tmp.push('\\bActiveXObject\\b');tmp=tmp.join('|');SimpleHtmlTestRegExp=new RegExp(tmp,'');};LexerTopLevel.prototype=new LexerBase ();LexerTopLevel.prototype.constructor=LexerTopLevel;LexerTopLevel.superclass=LexerBase.prototype;var LexerTopLevelRegExp=LexerBase['makeRegExp'](LexerTopLevel_gramm,'gi');var LexerTopLevelGrammArray=LexerBase['makeGramm'](LexerTopLevel_gramm,'gi');var LexerTopLevelTokenMatch=make_top_level_match();var LexerTextAreaRegExp=LexerBase['makeRegExp'](LexerTextArea_gramm,'gi');var LexerTextAreaGrammArray=LexerBase['makeGramm'](LexerTextArea_gramm,'gi');function LexerTopLevel (gramm,flag,lexRegExp,lexGrammArray){if (arguments.length>0){LexerTopLevel.superclass['init'].call (this,gramm,flag,lexRegExp,lexGrammArray);this.sublexer=null;this.bodies=null;this.tags=null;this.re_array_start=[/
You are completely right. For some reason my brain did not clue in on the _Manager portion of Zend_Cache. I guess that is what I get for trying to answer mailing list emails without first having the morning coffee.
 
Cheers!
Ralph


From: Pádraic Brady [mailto:padraic.brady@yahoo.com]
Sent: Tue 2/16/2010 3:40 PM
To: Ralph Schindler
Cc: Zend Framework MVC
Subject: Re: [fw-mvc] zend_registry or zend_cache_manager

Slightly off the rails ;). Cache_Manager is a repository of cache configurations to assist in lazy-loading caches as needed (rather than instantiating them all up front or piecemeal across the app), so in a sense it works almost like a Registry, albeit one strictly tied to caches.
 
Pádraic Brady

http://blog.astrumfutura.com
http://www.survivethedeepend.com
OpenID Europe Foundation Irish Representative



From: Ralph Schindler <ralph.schindler@zend.com>
To: sina miandashti <miandashti@gmail.com>; Zend MVC <fw-mvc@lists.zend.com>
Sent: Tue, February 16, 2010 4:27:16 PM
Subject: RE: [fw-mvc] zend_registry or zend_cache_manager

Hmm, I think it's best to back up and talk about the role of a cache vs. the role of a registry.
 
In PHP, a cache is used to store objects, text, and other stuff that might have been complex, timely, resource intensive or otherwise expensive to generate.  It is stored in a fashion such that the cost of generating whatever it was is not incurred on each and every request, but so that the cost is incurred on one request, and the result can be shared across multiple requests. (Remember, PHP is a shared-nothing architecture, objects cannot be shared between requests without some form of serializing-storing-unserializing). That is what Zend_Cache is for.
 
Zend_Registry, on the other hand, serves a much different purpose. Following the mantra "globals are evil", Zend_Regstry allows for a static place that objects can be stored so that they can be retrieved from a known place during the lifetime of a request.  A typical scenario might be this: a bootstrap script creates a database object, or even a cacheManager object, then inside a controller script you need to retrieve those objects. Since the objects are inside of the application's registry, you know that is the place where they can be retrieved from. Zend_Registry does not persist objects between requests; meaning any contents will be destroyed at request end, and will need to be re-created on the next request to be used. Zend_Registry is more for code convenience, not performance.
 
Hope that helps,
Ralph
 
 


From: Volker Orgeldinger on behalf of sina miandashti
Sent: Tue 2/16/2010 12:45 AM
To: 'Zend MVC'
Subject: [fw-mvc] zend_registry or zend_cache_manager

hi all developers ;)


$cache = Zend_Cache::factory('Core','File',$frontend,$backend);

1:


$manager = new Zend_Cache_Manager;
$manager->setCache('appcache', $cache);


2:

Zend_Registry::set ( 'cache', $cache );

------------------------------------------------------------------------

which one is better for storing the $cache object ...   ?

for better performance and better memory usage and etc...

--
________________
Sincerely
Sina Miandashti
MuSicBasE.ir & InvisionPower.ir Admin

没有评论: