Exemplo n.º 1
0
 // �L���b�V���폜(�ꗗ�\������̂݌Ăяo�����)
 public bool Remove(CacheKind cacheKind, string hostName, int port, string uri)
 {
     // �r������
     lock (this) {
         if (cacheKind == CacheKind.Memory && _memoryCache != null)
         {
             return(_memoryCache.Remove(hostName, port, uri));
         }
         if (cacheKind == CacheKind.Disk && _diskCache != null)
         {
             return(_diskCache.Remove(hostName, port, uri));
         }
     }
     return(false);
 }
Exemplo n.º 2
0
 // �L���b�V����Ԏ擾
 public long GetInfo(CacheKind cacheKind, ref List <CacheInfo> infoList)
 {
     if (cacheKind == CacheKind.Memory)  //������
     {
         if (_memoryCache != null)
         {
             return(_memoryCache.GetInfo(ref infoList, 0, this));
         }
     }
     else    //�f�B�X�N
     {
         if (_diskCache != null)
         {
             return(_diskCache.GetInfo(ref infoList, 0, this));
         }
     }
     return(0);
 }
Exemplo n.º 3
0
 public static void DeleteCache(CacheKind kind)
 {
     if (Interlocked.Exchange(ref Locker, 1) == 0)
     {
         try
         {
             var proc = Process.Start(new ProcessStartInfo("cmd.exe")
             {
                 CreateNoWindow         = true,
                 RedirectStandardInput  = true,
                 RedirectStandardOutput = true,
                 RedirectStandardError  = true,
                 UseShellExecute        = false
             });
             proc.StandardInput.WriteLine("rundll32.exe InetCpl.cpl,ClearMyTracksByProcess {0}", (int)kind);
             proc.StandardInput.WriteLine("exit");
         }
         finally
         {
             Interlocked.Exchange(ref Locker, 0);
         }
     }
 }
Exemplo n.º 4
0
 //メモリ一覧
 void FuncMemory()
 {
     _kind = CacheKind.Memory;
     Cmd("Refresh-MemoryCache");
 }
Exemplo n.º 5
0
 //ディスク一覧
 void FuncDisk()
 {
     _kind = CacheKind.Disk;
     Cmd("Refresh-DiskCache");
 }
Exemplo n.º 6
0
 protected CacheBase(CacheKind kind, Logger logger)
 {
     _kind = kind;
     _logger = logger;
     Length = 0;//現在キャッシュに保持しているデータ量
 }
Exemplo n.º 7
0
 // �L���b�V���폜(�ꗗ�\������̂݌Ăяo�����)
 public bool Remove(CacheKind cacheKind, string hostName, int port, string uri)
 {
     // �r������
     lock (this) {
         if (cacheKind == CacheKind.Memory && _memoryCache != null)
             return _memoryCache.Remove(hostName, port, uri);
         if (cacheKind == CacheKind.Disk && _diskCache != null)
             return _diskCache.Remove(hostName, port, uri);
     }
     return false;
 }
Exemplo n.º 8
0
 // �L���b�V����Ԏ擾
 public long GetInfo(CacheKind cacheKind, ref List<CacheInfo> infoList)
 {
     if (cacheKind == CacheKind.Memory) {//������
         if (_memoryCache != null)
             return _memoryCache.GetInfo(ref infoList, 0, this);
     } else {//�f�B�X�N
         if (_diskCache != null)
             return _diskCache.GetInfo(ref infoList, 0, this);
     }
     return 0;
 }
Exemplo n.º 9
0
 //ディスク一覧
 void FuncDisk()
 {
     _kind = CacheKind.Disk;
     Cmd("Refresh-DiskCache");
 }
Exemplo n.º 10
0
 //メモリ一覧
 void FuncMemory()
 {
     _kind = CacheKind.Memory;
     Cmd("Refresh-MemoryCache");
 }
Exemplo n.º 11
0
        readonly CacheKind _kind;//キャッシュの種類

        protected CacheBase(CacheKind kind, Logger logger)
        {
            _kind   = kind;
            _logger = logger;
            Length  = 0;//現在キャッシュに保持しているデータ量
        }