00001 using System;
00002 using Common;
00003
00004 namespace Server {
00008 public class ServerCacheManager : CacheManager {
00009
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)) {
00019 Console.WriteLine("- URI Mapping for {0} is not fresh. Spawning HTTP Request", request.URI);
00020 response = masterControl.httpStub.ServiceRequest(request);
00021
00022 UpdateCache(response, request.URI);
00023 } else {
00024 Console.WriteLine("- Servicing request for {0} from Server Cache", request.URI);
00025 response = Get(request);
00026
00027 }
00028 return response;
00029 }
00030 }
00031 }