vod_live_response_cache
The 'vod_live_response_cache' directive manages caching for live video response streams in NGINX's VOD module.
Description
The 'vod_live_response_cache' directive is part of the NGINX-based VOD packager module, which is used to enhance the efficiency of live video streaming. It allows server administrators to cache responses generated by live video requests, optimizing resource utilization and improving response times. By enabling caching, the server may serve repeated requests for the same video content from cached responses instead of generating fresh responses every time.
The directive accepts up to three arguments: the cache duration in seconds, the maximum cache size in bytes, and a flag to enable or disable cache validation. By configuring these parameters, administrators can fine-tune caching behavior to balance between performance and content freshness. For example, a longer cache expiration may improve performance but risk serving outdated content, while shorter caching may ensure viewers are always accessing the latest video stream.
When caching is enabled, NGINX intelligently stores content temporarily based on the defined parameters. The directive functions within various contexts, meaning it can be applied globally in the HTTP block or specifically within a server or location block, providing flexibility depending on the unique requirements of different live streams.
Config Example
http {
vod_live_response_cache 60s 100m on;
}
server {
location /live {
vod_live_response_cache 120s;
}
}Ensure the cache duration aligns with the expected live event duration to avoid stale content.
Be cautious when setting large cache sizes, as they may consume significant server resources.
Make sure to enable cache validation appropriately to keep the content up-to-date.