Exemplo n.º 1
0
        private byte[] GetFromRemote(CacheSettings cs, string path)
        {
            var data = GetFromRemote(path);

            if (cs.Cached)
            {
                cs.CacheDependency = CacheHelper.GetCacheDependency(BlobCacheHelper.GetCacheDependency(path));
            }

            return(data);
        }
Exemplo n.º 2
0
        public void Discard(string path)
        {
            switch (_cacheType)
            {
            case BlobCacheType.Memory:
                CacheHelper.TouchKey(BlobCacheHelper.GetCacheDependency(path));
                break;

            case BlobCacheType.FileSystem:
                var tempFilePath = AzurePathHelper.GetTempBlobPath(path);
                if (System.IO.File.Exists(tempFilePath))
                {
                    System.IO.File.Delete(tempFilePath);
                }
                break;
            }
        }
Exemplo n.º 3
0
        private void AddToCache(string path, byte[] data, DateTime created)
        {
            switch (_cacheType)
            {
            case BlobCacheType.Memory:
                CacheHelper.Add(BlobCacheHelper.GetCacheKey(path), data, CacheHelper.GetCacheDependency(BlobCacheHelper.GetCacheDependency(path)), DateTime.Now.AddMinutes(AccountInfo.Instance.BlobCacheMinutes), System.Web.Caching.Cache.NoSlidingExpiration);
                break;

            case BlobCacheType.FileSystem:
                AddToFileSystem(path, data, created);
                break;
            }
        }