/// <summary> /// The constructor. /// </summary> public Service() { // Set the host name ServiceName = "Dache Cache Host"; // Load custom logging _logger = CustomLoggerLoader.LoadLogger(); }
/// <summary> /// The constructor. /// </summary> public Service() { // Set the host name ServiceName = "Dache Cache Host"; // Load custom logging CustomLoggerLoader.DefaultLogger = new EventViewerLogger("Cache Host", "Dache"); _logger = CustomLoggerLoader.LoadLogger(); }
/// <summary> /// The constructor. /// </summary> /// <param name="configuration">The configuration to use for the cache host.</param> public CacheHostEngine(CacheHostConfigurationSection configuration) { // Sanitize if (configuration == null) { throw new ArgumentNullException("configuration"); } // Set default logger to file if necessary if (CustomLoggerLoader.DefaultLogger == null) { CustomLoggerLoader.DefaultLogger = new FileLogger(); } var port = configuration.Port; var physicalMemoryLimitPercentage = configuration.CacheMemoryLimitPercentage; var maximumConnections = configuration.MaximumConnections; // Configure the performance counter data manager PerformanceDataManager performanceDataManager = null; try { performanceDataManager = new PerformanceCounterPerformanceDataManager(port); } catch (InvalidOperationException) { // Performance counters aren't installed, so don't use them performanceDataManager = new PerformanceDataManager(); } // Determine the MemCache to use IMemCache memCache = new MemCache(physicalMemoryLimitPercentage, performanceDataManager); if (configuration.CompressData) { memCache = new GZipMemCache(memCache); } // Initialize the tag routing table var tagRoutingTable = new TagRoutingTable(); // Initialize the cache host server var cacheHostServer = new CacheHostServer(memCache, tagRoutingTable, CustomLoggerLoader.LoadLogger(), configuration.Port, configuration.MaximumConnections, configuration.MessageBufferSize, configuration.CommunicationTimeoutSeconds * 1000, configuration.MaximumMessageSizeKB * 1024); // Instantiate the cache host runner _cacheHostRunner = new CacheHostRunner(cacheHostServer); }