|
bool | Exists [get] |
|
DateTime | ModifiedDateUTC [get] |
|
string | VirtualPath [get] |
| The virtual path of the file (relative to the domain, like /app/folder/file.ext) More...
|
|
DateTime | ModifiedDateUTC [get] |
| The modified (last write time) of the source file, in UTC form. More...
|
|
Definition at line 19 of file S3File.cs.
override Stream ImageResizer.Plugins.S3Reader.S3File.Open |
( |
| ) |
|
|
inline |
Returns an opened stream to the file contents.
- Returns
Implements ImageResizer.Plugins.IVirtualFile.
Definition at line 105 of file S3File.cs.
108 var req =
new Amazon.S3.Model.GetObjectRequest() { BucketName = bucket, Key = key };
110 using (var s = provider.S3Client.GetObject(req)){
111 return StreamExtensions.CopyToMemoryStream(s.ResponseStream);
113 }
catch (AmazonS3Exception se) {
114 if (se.StatusCode == System.Net.HttpStatusCode.NotFound ||
"NoSuchKey".Equals(se.ErrorCode, StringComparison.OrdinalIgnoreCase))
throw new FileNotFoundException(
"Amazon S3 file not found", se);
115 else if ( se.StatusCode == System.Net.HttpStatusCode.Forbidden ||
"AccessDenied".Equals(se.ErrorCode, StringComparison.OrdinalIgnoreCase))
throw new FileNotFoundException(
"Amazon S3 access denied - file may not exist", se);
void ImageResizer.Plugins.S3Reader.S3File.UpdateMetadata |
( |
| ) |
|
|
inline |
Updates the exists and modified date
Definition at line 30 of file S3File.cs.
32 string ckey = provider.VirtualFilesystemPrefix +
"/" + bucket +
"/" + key;
33 Cache c = HttpContext.Current.Cache;
34 object o = c.Get(ckey);
37 _fileModifiedDate = (Nullable<DateTime>)o;
38 }
else if (o is
bool) {
40 _fileModifiedDate = null;
43 var request =
new GetObjectMetadataRequest(){ BucketName = bucket, Key = key};
46 using (GetObjectMetadataResponse response = provider.S3Client.GetObjectMetadata(request)) {
49 _fileModifiedDate = response.LastModified;
51 }
catch (AmazonS3Exception s3e) {
52 if (s3e.StatusCode == System.Net.HttpStatusCode.NotFound || s3e.StatusCode == System.Net.HttpStatusCode.Forbidden) {
55 _fileModifiedDate = null;
59 object obj = (_fileModifiedDate == null) ? (
object)
false : (object)_fileModifiedDate.Value;
TimeSpan MetadataAbsoluteExpiration
Existence and modified date metadata about files is cached for, at longest, this amount of time after...
The documentation for this class was generated from the following file:
- C:/Users/nathanael/Documents/resizer/Plugins/S3Reader/S3File.cs