//リモート操作(データの取得) override public string Cmd(string cmdStr) { if (cmdStr == "Refresh-DiskCache" || cmdStr == "Refresh-MemoryCache") { var infoList = new List <CacheInfo>(); _cache.GetInfo((cmdStr == "Refresh-MemoryCache")?CacheKind.Memory : CacheKind.Disk, ref infoList); var sb = new StringBuilder(); foreach (CacheInfo cacheInfo in infoList) { sb.Append(cacheInfo + "\b"); } return(sb.ToString()); } if (cmdStr.IndexOf("Cmd-Remove") == 0) { var tmp = cmdStr.Split('\t'); if (tmp.Length != 5) { return("false"); } var kind = (CacheKind)Enum.Parse(typeof(CacheKind), tmp[1]); var hostName = tmp[2]; var port = Convert.ToInt32(tmp[3]); var uri = tmp[4]; if (_cache.Remove(kind, hostName, port, uri)) { return("true"); } return("false"); } return(""); }
//リモート操作(データの取得) override public string Cmd(string cmdStr) { if (cmdStr == "Refresh-DiskCache" || cmdStr == "Refresh-MemoryCache") { List <CacheInfo> infoList = new List <CacheInfo>(); CACHE_KIND cacheKind = CACHE_KIND.DISK; if (cmdStr == "Refresh-MemoryCache") { cacheKind = CACHE_KIND.MEMORY; } long size = cache.GetInfo(cacheKind, ref infoList); StringBuilder sb = new StringBuilder(); foreach (CacheInfo cacheInfo in infoList) { sb.Append(cacheInfo.ToString() + "\b"); } return(sb.ToString()); } else if (cmdStr.IndexOf("Cmd-Remove") == 0) { string[] tmp = cmdStr.Split('\t'); if (tmp.Length != 5) { return("false"); } CACHE_KIND kind = (CACHE_KIND)Enum.Parse(typeof(CACHE_KIND), tmp[1]); string hostName = tmp[2]; int port = Convert.ToInt32(tmp[3]); string uri = tmp[4]; if (cache.Remove(kind, hostName, port, uri)) { return("true"); } return("false"); } return(""); }