/cacheManagement/examples/root/basic/index.cfm

http://coldfusioncachemanager.googlecode.com/ · ColdFusion · 85 lines · 47 code · 38 blank · 0 comment · 4 complexity · 983330d1088b48a3fcb3b9f7a3038228 MD5 · raw file

  1. <cfimport taglib="/cacheManagement/util/" prefix="cache" />
  2. <html>
  3. <head>
  4. <link type="text/css" href="/cacheManagement/examples/assets/style.css" rel="stylesheet" />
  5. <title>Cache Management Examples</title>
  6. </head>
  7. <body>
  8. <cfscript>
  9. cm = getCacheManager();
  10. startTime = getTickCount();
  11. if( not cm.exists( 'Computer', 'myComposite' ) ){
  12. message = "set a cache";
  13. c = getFactory().createComputer();
  14. cm.add( 'Computer', 'myComposite', c );
  15. }else{
  16. for( f=1; f<=5; f++ ){
  17. for( i=1; i<=1; i++ ){
  18. c = cm.get( 'Computer', 'myComposite' );
  19. }
  20. sleep( 10 );
  21. }
  22. message = "get a cache";
  23. }
  24. endTime = getTickCount();
  25. totalExecution = endTime - startTime;
  26. </cfscript>
  27. <div class="title">Basic examples</div>
  28. <p></p>
  29. <textarea cols="60" rows="5" class="code">
  30. cm = getCacheManager();
  31. startTime = getTickCount();
  32. if( not cm.exists( 'Computer', 'myComposite' ) ){
  33. c = getFactory().createComputer();
  34. cm.add( 'Computer', 'myComposite', c );
  35. }else{
  36. c = cm.get( 'Computer', 'myComposite' );
  37. }
  38. endTime = getTickCount();
  39. totalExecution = endTime - startTime;
  40. </textarea><br/>
  41. <br/>
  42. <p>Command: <cfoutput>#message#</cfoutput>.</p>
  43. <p>Total execution time: <cfoutput>#totalExecution#</cfoutput> ms</p>
  44. <a href="../../index.cfm">Back to home</a><br />
  45. <cache:monitor cacheManager="#cm#" />
  46. </body>
  47. </html>