// this element should always be dynamic request.element.isStatic = 0; // calc base name (Pageid + ControlID) basename = "#request.page.id#_#request.element.id#"; // Check if any missing attributes missingAttr = getMissingAttributes();
Page Param Cache
Error: Missing custom script parameters: #Replace( missingAttr, ",", ", ", "ALL")#
// copy params if( StructKeyExists( attributes, 'params' ) ) paramsList = Trim(attributes.params); else paramsList = ''; // Create Memory Structures if they don't exist CreateMemStructures(attributes.elementType, basename); // build ordered param string which will be key to memory cache paramStr = BuildOrderParams(paramsList); // default forceRender to 0 if not specified if( NOT StructKeyExists(request.params,"ForceRender") ) request.params.ForceRender = 0; // Get Minutes to Cache minToCache = CheckExpressions(paramStr); // Handle request to clear the memory, if 'ClearMemCache' is specified in URL params if( StructKeyExists(request.params,'ClearMemCache') AND StructKeyExists(Application.CS_PageParamCache[attributes.ElementType],basename) ) { StructDelete(Application.CS_PageParamCache[attributes.ElementType],basename); Application.CS_PageParamCache[attributes.ElementType][basename] = StructNew(); }
Page Param Cache: [Clear Memory Cache]   Cache Duration: [#minToCache# minutes]   Count: [#StructCount(application.CS_PageParamCache[attributes.ElementType][basename])#] MaxItems: [#attributes.MaxItemsToCache#]
bMakeCache = 1;
Page Param Cache: DEBUG Parameter is ON
[Clear Memory Cache]   Cache Duration: [#minToCache# minutes] Count: [#StructCount(application.CS_PageParamCache[attributes.ElementType][basename])#] MaxItems: [#attributes.MaxItemsToCache#]

---Rendered from cache. Expires in #DateDiff( 's', now(), application.CS_PageParamCache[attributes.ElementType][basename][paramStr].expires)# second at #application.CS_PageParamCache[attributes.ElementType][basename][paramStr].expires# ----
#application.CS_PageParamCache[attributes.ElementType][basename][paramStr].data# #application.CS_PageParamCache[attributes.ElementType][basename][paramStr].data# if( newcache neq '' ) application.CS_PageParamCache[attributes.ElementType][basename][paramStr].data = newCache; application.CS_PageParamCache[attributes.ElementType][basename][paramStr].hitCount = application.CS_PageParamCache[attributes.ElementType][basename][paramStr].hitCount + 1; application.CS_PageParamCache[attributes.ElementType][basename][paramStr].lastuse = now();

==== RENDERED ELEMENT ===
#theOutput# // Make sure we don't cache more than the max specified. If attributes.MaxItemsToCache = 0, then unlimited // If the item already exist in mem cache allow. alreadyExists = StructKeyExists( application.CS_PageParamCache[attributes.ElementType][basename],'#paramStr#' ); curItemCount = ListLen( StructKeyList(application.CS_PageParamCache[attributes.ElementType][basename]) ); if( alreadyExists OR attributes.MaxItemsToCache eq 0 OR curItemCount LT attributes.MaxItemsToCache ) { application.CS_PageParamCache[attributes.ElementType][basename][paramStr] = StructNew(); application.CS_PageParamCache[attributes.ElementType][basename][paramStr].expires = DateAdd( "n", minToCache, now() ); application.CS_PageParamCache[attributes.ElementType][basename][paramStr].data = theOutput; application.CS_PageParamCache[attributes.ElementType][basename][paramStr].hitCount = 0; application.CS_PageParamCache[attributes.ElementType][basename][paramStr].created = now(); application.CS_PageParamCache[attributes.ElementType][basename][paramStr].lastuse = now(); application.CS_PageParamCache[attributes.ElementType][basename][paramStr].minutesToCache = minToCache; } var missingAttr = ''; if( NOT StructKeyExists(attributes,"ElementType") ) missingAttr = ListAppend(missingAttr,"ElementType"); if( NOT StructKeyExists(attributes,"ElementName") ) missingAttr = ListAppend(missingAttr,"ElementName"); if( NOT StructKeyExists(attributes,"MinutesToCache") ) missingAttr = ListAppend(missingAttr,"MinutesToCache"); if( NOT StructKeyExists(attributes,"ShowClearLink") ) attributes.ShowClearLink = 0; if( NOT StructKeyExists(attributes,"Debug") ) attributes.Debug = 0; if( NOT StructKeyExists(attributes,"MaxItemsToCache") ) attributes.MaxItemsToCache = 200; // Create the base memory structure if it does not exist. if( NOT StructKeyExists(Application,"CS_PageParamCache") ) application.CS_PageParamCache = StructNew(); if( NOT StructKeyExists(Application.CS_PageParamCache, arguments.elementType) ) application.CS_PageParamCache[arguments.elementType] = StructNew(); if( NOT StructKeyExists(Application.CS_PageParamCache[arguments.elementType], arguments.basename) ) application.CS_PageParamCache[arguments.elementType][arguments.basename] = StructNew(); var i = 1; var item = ''; var paramStr = ''; var paramKeyList = StructKeyList(request.params); var excludeList = 'noparams,clearmemcache,forcerender,cs_pgisinlview,cs_forcereadmode,renderelements,renderforprint,rendercontrolidlist,fieldnames,comments,RENDERCONTROLIDLIST,RENDERELEMENTS'; if( ListLen(paramKeyList) ) { paramKeyList = LCase( paramKeyList ); paramKeyList = ListSort( paramKeyList, "textnocase" ); for( i=1; i lte ListLen( paramKeyList ); i = i + 1 ) { item = Trim(ListGetAt(paramKeyList,i)); if( arguments.includeList neq '' ) { if( ListFindNoCase( includeList, item) ) paramStr = paramStr & "&" & item & "=" & Trim(request.params[item]); } else if( NOT ListFindNoCase(excludeList, item) ) paramStr = paramStr & "&" & item & "=" & Trim(request.params[item]); } } if( paramStr eq '' ) paramStr = '&noparams=1'; var i = 1; var MinToCache = attributes.MinutesToCache; var expression = ''; var found = 0; for( i=1; i lte 10; i = i + 1 ) { if( NOT StructKeyExists( attributes,'Exp#i#' ) ) break; expression = ListFirst( attributes['Exp#i#'] ); found = FindNoCase( expression, arguments.paramStr ); if( attributes.Debug eq 1 ) WriteOutput( '
Checking Expression #i#: exp:#expression# params:#arguments.paramStr# found:#found#' ); if( found ) { MinToCache = ListLast( attributes['Exp#i#'] ); break; } }