Changeset 1703
- Timestamp:
- 08/14/08 15:29:16 (5 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
coldbox/trunk/system/cache/cacheManager.cfc
r1699 r1703 422 422 //Check for creation timeouts and clear 423 423 if ( dateDiff("n", poolStruct[thisKey].created, now() ) gte poolStruct[thisKey].Timeout ){ 424 /* Clear The Key */ 424 425 clearKey(thisKey); 426 /* Announce Expiration */ 427 announceExpiration(thisKey); 425 428 continue; 426 429 } … … 428 431 if ( ccBean.getCacheUseLastAccessTimeouts() and 429 432 dateDiff("n", poolStruct[thisKey].lastAccesed, now() ) gte ccBean.getCacheObjectDefaultLastAccessTimeout() ){ 433 /* Clear the Key */ 430 434 clearKey(thisKey); 435 /* Announce Expiration */ 436 announceExpiration(thisKey); 431 437 continue; 432 438 } … … 581 587 582 588 <!------------------------------------------- PRIVATE -------------------------------------------> 583 589 590 <!--- announceExpiration ---> 591 <cffunction name="announceExpiration" output="false" access="private" returntype="void" hint="Announce an Expiration"> 592 <cfargument name="objectKey" type="string" required="true" hint="The object key to announce expiration"/> 593 <cfscript> 594 var interceptData = structnew(); 595 /* interceptData */ 596 interceptData.cacheObjectKey = arguments.objectKey; 597 /* Execute afterCacheElementExpired Interception */ 598 instance.controller.getInterceptorService().processState("afterCacheElementExpired",interceptData); 599 </cfscript> 600 </cffunction> 601 584 602 <!--- Initialize our object cache pool ---> 585 603 <cffunction name="initPool" access="private" output="false" returntype="void" hint="Initialize and set the internal object Pool"> coldbox/trunk/testing/tests/cases/cache/CacheManagerTest.cfc
r1647 r1703 15 15 <cfscript> 16 16 super.setup(); 17 mockController = mockfactory.createMock('coldbox.system.controller'); 18 mockService = mockFactory.createMock('coldbox.system.services.interceptorService'); 19 20 mockController.mockMethod('getInterceptorService').returns(mockService); 21 mockController.mockMethod('getAppHash').returns(hash(createUUID()) ); 22 23 ccbean = createObject("component","coldbox.system.beans.cacheConfigBean"); 24 memento = structnew(); 25 memento.CacheObjectDefaultTimeout = 20; 26 memento.CacheObjectDefaultLastAccessTimeout = 20; 27 memento.CacheReapFrequency = 1; 28 memento.CacheMaxObjects = 100; 29 memento.CacheFreeMemoryPercentageThreshold = 1; 30 memento.CacheUseLastAccessTimeouts = true; 31 memento.CacheEvictionPolicy = "FIFO"; 32 ccbean.init(argumentCollection=memento); 33 34 cm = createObject("component","coldbox.system.cache.cacheManager").init(mockController); 17 35 </cfscript> 18 36 </cffunction> 19 37 20 <cffunction name="testConfig s" access="public" returntype="void" hint="" output="false" >38 <cffunction name="testConfigure" access="public" returntype="void" hint="" output="false" > 21 39 <cfscript> 22 var local = structnew(); 23 24 40 cm.configure(ccbean); 41 </cfscript> 42 </cffunction> 43 44 <cffunction name="testannounceExpiration" output="false"> 45 <cfscript> 46 makePublic(cm,"announceExpiration","_announceExpiration"); 47 cm._announceExpiration('test'); 25 48 </cfscript> 26 49 </cffunction>
