I’m looking at the new caching functionality, and I’ve set it up for use with Plex, but I have some questions that the documentation doesn’t answer.
How is the cache built? Is it done on demand?
Once the cache is built, how does it get updated if I add files by rclone move (or copy)? In other words, how does the cache pick up changes to the remote?
Does the cache expire after the info_age regardless of whether it has been accessed within that time period?
Does the cache expire if I unmount the remote? In other words, would the cache survive a system reboot?
The cache remote wraps around another remote just as the crypt remote and is filled with directory & file information as well as file data upon it is requested. the directory & file metadata is saved in a (bolt) DB. File chunks are saved in as separate chunk files in the filesystem.
the cache gets only updated if you write/upload through the cache remote - external changes will only be picked up if you clean & rebuild the cache or if the info_age expires for a requested subdir. reading the google drive activity log is not yet implemented.
all cached items expire once they are older then info_age. they surely have been accessed, otherwise they would not have been cached
the cache state is persistent as it is saved to the (bolt) DB and will survive a remount/reboot. you can however start the mount with --cache-db-purge to manually reset the cache db.
one more thing: it is not possible to use a rclone cache remote concurrently more then once , the db will be locked. (e.g. no rclone ls cacheremote: while a mount is active for cacheremote:)
Ok. So, I have mounted the cached remote on the file system. That’s what Plex uses. The cache builds when the files on the remote are listed or accessed.
When Plex does a library scan, it will essentially cache the entire media folder and that will live for the length of info_age.
I currently use a union mount to keep recent media local and older media on the remote. If I move files that are cached to the remote and Plex does another scan before the info_age period expires, Plex will show those files as unavailable until the next time the cache is generated. Is there any way around this?
you yould send a SIGHUP to the rclone process. this will purge all cache information and newly added content will show up.
BUT: if you do this and rescan the whole library every time you will most likely get a 24h ban. instead of rescanning whole sections in plex you could use the command line client to only scan subdirectories for new content to avoid a ban.
Yeah. That’s what I do now. I have automation that manages all that. I was just exploring the caching option. It looks like it’s not going to work out though.
I’m interested in the Plex integration though. I’ll have to investigate that a bit more.
the command you want to run is not plex , that is the user it is supposed to run under, hence the sudo -u plex -i.
the actual command is LD_LIBRARY_PATH="/usr/lib/plexmediaserver" "/usr/lib/plexmediaserver/Plex Media Scanner" --scan --refresh --section 2 --directory "/home/plex/content/something/subdir/"