public void InvalidateObject(string bucket, string key)
        {
            var distId = GetDistributionIdFor(bucket);
            if(!string.IsNullOrWhiteSpace(distId))
            {
                var invalidationRequest = new PostInvalidationRequest()
                    .WithDistribtionId(distId)
                    .WithInvalidationBatch(new InvalidationBatch(DateTime.Now.ToString(dateFormatWithMilliseconds), new List<string> { key }));

                cloudFrontClient.PostInvalidation(invalidationRequest);
            }
        }
예제 #2
0
 private void InvalidateCloudFront(params string[] paths)
 {
     if (_revalidateCloudFront && !string.IsNullOrEmpty(_distributionId))
     {
         using (var cfClient = GetCloudFrontClient())
         {
             var invalidationRequest = new PostInvalidationRequest
                                           {
                                               DistributionId = _distributionId,
                                               InvalidationBatch =
                                                   new InvalidationBatch().WithCallerReference(Guid.NewGuid().ToString()).WithPaths
                                                   (paths)
                                           };
             cfClient.PostInvalidation(invalidationRequest);
         }
     }
 }