mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-12-14 09:05:09 +00:00
feat: Add Video Cache compression
Video information from youtube always weight about ~60KB uncompressed. When using Deflate to compress that information, it gets compressed down to ~15KB, so now you will be able to store up to 4x entries more with caching enabled. For context, nadeko.net Invidious instance stores 54.7k keys, since we also store the `time` in a different key associated to the video ID, the real count of videos cached would be 27.3k. With compression enabled, the Redis database will be able to store up to 4 times more videos in cache, which is 109.2k videos cached. Pretty cool huh.
This commit is contained in:
@@ -238,6 +238,8 @@ class Config
|
||||
property backend : Int32 = 1
|
||||
# Max quantity of keys that can be held on the LRU cache
|
||||
property lru_max_size : Int32 = 18432 # ~512MB
|
||||
# Compress cache with Deflate
|
||||
property compress : Bool = false
|
||||
end
|
||||
|
||||
property check_backends_interval : Int32 = 30
|
||||
@@ -453,6 +455,10 @@ class Config
|
||||
puts "1 (Redis compatible DB) (Default)"
|
||||
puts "2 (In memory LRU)"
|
||||
end
|
||||
if config.video_cache.compress && config.video_cache.backend == 0
|
||||
puts "Video Cache compression can only be enabled when using backend 1 (Redis) or 2 (LRU)"
|
||||
exit(1)
|
||||
end
|
||||
end
|
||||
|
||||
# Check if the socket configuration is valid
|
||||
|
||||
Reference in New Issue
Block a user