Increase cache duration for resources

This commit is contained in:
Gabe Kangas 2021-11-07 19:53:01 -08:00
parent a1d2abc541
commit b7865c92b5

View File

@ -177,7 +177,7 @@ func GetCacheDurationSecondsForPath(filePath string) int {
return 20 return 20
} else if fileExtension == ".js" || fileExtension == ".css" { } else if fileExtension == ".js" || fileExtension == ".css" {
// Cache javascript & CSS // Cache javascript & CSS
return 60 * 10 return 60 * 60 * 3
} else if fileExtension == ".ts" { } else if fileExtension == ".ts" {
// Cache video segments as long as you want. They can't change. // Cache video segments as long as you want. They can't change.
// This matters most for local hosting of segments for recordings // This matters most for local hosting of segments for recordings
@ -186,11 +186,11 @@ func GetCacheDurationSecondsForPath(filePath string) int {
} else if fileExtension == ".m3u8" { } else if fileExtension == ".m3u8" {
return 0 return 0
} else if fileExtension == ".jpg" || fileExtension == ".png" || fileExtension == ".gif" || fileExtension == ".svg" { } else if fileExtension == ".jpg" || fileExtension == ".png" || fileExtension == ".gif" || fileExtension == ".svg" {
return 60 * 60 * 24 return 60 * 60 * 24 * 7
} }
// Default cache length in seconds // Default cache length in seconds
return 60 * 10 return 60 * 60 * 2
} }
// IsValidURL will return if a URL string is a valid URL or not. // IsValidURL will return if a URL string is a valid URL or not.