mirror of
https://github.com/minio/minio.git
synced 2025-11-29 13:28:17 -05:00
Add support for missing Cache-Control directives (#8619)
no-cache, only-if-cached and no-store directives are being enforced in this PR.
This commit is contained in:
@@ -185,12 +185,17 @@ func (c *cacheObjects) GetObjectNInfo(ctx context.Context, bucket, object string
|
||||
cacheReader, cacheErr := c.get(ctx, dcache, bucket, object, rs, h, opts)
|
||||
if cacheErr == nil {
|
||||
cc = cacheControlOpts(cacheReader.ObjInfo)
|
||||
if !cc.isStale(cacheReader.ObjInfo.ModTime) {
|
||||
if (!cc.isEmpty() && !cc.isStale(cacheReader.ObjInfo.ModTime)) ||
|
||||
cc.onlyIfCached {
|
||||
// This is a cache hit, mark it so
|
||||
c.cacheStats.incHit()
|
||||
c.cacheStats.incBytesServed(cacheReader.ObjInfo.Size)
|
||||
return cacheReader, nil
|
||||
}
|
||||
if cc.noStore {
|
||||
c.cacheStats.incMiss()
|
||||
return c.GetObjectNInfo(ctx, bucket, object, rs, h, lockType, opts)
|
||||
}
|
||||
}
|
||||
|
||||
// Reaching here implies cache miss
|
||||
|
||||
Reference in New Issue
Block a user