Main Page | Class Hierarchy | Class List | File List | Class Members

ServerCache.cs

00001 using System;
00002 using Common;
00003 
00004 namespace Server {
00008         public class ServerCacheManager : CacheManager {
00009 //              const long SERVER_CACHE_SIZE = 32 * 1024 * 1024; // 32Mb
00010                 MCP masterControl; 
00011 
00012                 public ServerCacheManager(MCP masterControl) : base(masterControl.settings.ServerCacheSize) {
00013                         this.masterControl = masterControl;
00014                 }
00015 
00016                 public HTTPResponse ServiceRequest(HTTPRequest request) {
00017                         HTTPResponse response;
00018                         if (!uriMapper.IsFresh(request.URI)) { // if URL <-> CHK mapping is not fresh
00019                                 Console.WriteLine("- URI Mapping for {0} is not fresh. Spawning HTTP Request", request.URI);
00020                                 response = masterControl.httpStub.ServiceRequest(request);
00021                                 // need to update and freshen
00022                                 UpdateCache(response, request.URI);
00023                         } else {
00024                                 Console.WriteLine("- Servicing request for {0} from Server Cache", request.URI);
00025                                 response = Get(request);
00026                                 // no need to update cache, and we should not freshen.
00027                         }
00028                         return response;
00029                 }
00030         }
00031 }

Generated on Mon May 8 22:07:27 2006 by  doxygen 1.3.9.1