|
|
@ -103,7 +103,6 @@ func (m *cacheMeta) ToObjectInfo(bucket, object string) (o ObjectInfo) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// We set file info only if its valid.
|
|
|
|
// We set file info only if its valid.
|
|
|
|
o.ModTime = m.Stat.ModTime |
|
|
|
|
|
|
|
o.Size = m.Stat.Size |
|
|
|
o.Size = m.Stat.Size |
|
|
|
o.ETag = extractETag(m.Meta) |
|
|
|
o.ETag = extractETag(m.Meta) |
|
|
|
o.ContentType = m.Meta["content-type"] |
|
|
|
o.ContentType = m.Meta["content-type"] |
|
|
@ -122,6 +121,12 @@ func (m *cacheMeta) ToObjectInfo(bucket, object string) (o ObjectInfo) { |
|
|
|
o.Expires = t.UTC() |
|
|
|
o.Expires = t.UTC() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if mtime, ok := m.Meta["last-modified"]; ok { |
|
|
|
|
|
|
|
if t, e = time.Parse(http.TimeFormat, mtime); e == nil { |
|
|
|
|
|
|
|
o.ModTime = t.UTC() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// etag/md5Sum has already been extracted. We need to
|
|
|
|
// etag/md5Sum has already been extracted. We need to
|
|
|
|
// remove to avoid it from appearing as part of user-defined metadata
|
|
|
|
// remove to avoid it from appearing as part of user-defined metadata
|
|
|
|
o.UserDefined = cleanMetadata(m.Meta) |
|
|
|
o.UserDefined = cleanMetadata(m.Meta) |
|
|
@ -506,9 +511,7 @@ func (c *diskCache) statCache(ctx context.Context, cacheObjPath string) (meta *c |
|
|
|
} |
|
|
|
} |
|
|
|
// get metadata of part.1 if full file has been cached.
|
|
|
|
// get metadata of part.1 if full file has been cached.
|
|
|
|
partial = true |
|
|
|
partial = true |
|
|
|
fi, err := os.Stat(pathJoin(cacheObjPath, cacheDataFile)) |
|
|
|
if _, err := os.Stat(pathJoin(cacheObjPath, cacheDataFile)); err == nil { |
|
|
|
if err == nil { |
|
|
|
|
|
|
|
meta.Stat.ModTime = atime.Get(fi) |
|
|
|
|
|
|
|
partial = false |
|
|
|
partial = false |
|
|
|
} |
|
|
|
} |
|
|
|
return meta, partial, meta.Hits, nil |
|
|
|
return meta, partial, meta.Hits, nil |
|
|
@ -570,7 +573,6 @@ func (c *diskCache) saveMetadata(ctx context.Context, bucket, object string, met |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
m.Stat.Size = actualSize |
|
|
|
m.Stat.Size = actualSize |
|
|
|
m.Stat.ModTime = UTCNow() |
|
|
|
|
|
|
|
if !incHitsOnly { |
|
|
|
if !incHitsOnly { |
|
|
|
// reset meta
|
|
|
|
// reset meta
|
|
|
|
m.Meta = meta |
|
|
|
m.Meta = meta |
|
|
|