Skip to content

Commit

Permalink
Merge pull request #21 from chenxiaolong/dir_cache
Browse files Browse the repository at this point in the history
Reduce directory cache time to 5 seconds
  • Loading branch information
chenxiaolong authored Jul 1, 2023
2 parents 7f7a198 + 38ff9a0 commit 77703a0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rcbridge/rcbridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,12 @@ func getVfs(remote string) (*vfs.VFS, error) {
v, ok := vfsCache[remote]
if !ok {
opts := vfscommon.DefaultOpt
// Significantly shorten the time that directory entries are cached so
// that file listings have a more accurate view after operations that
// touch the backend directly, like copying/moving. There's no public
// nor internal API for manually invalidating the directory cache, so
// reducing the timeout is our only option.
opts.DirCacheTime = 5 * time.Second
// This is required for O_RDWR
opts.CacheMode = vfscommon.CacheModeWrites
// Don't let the cache grow too big
Expand Down

0 comments on commit 77703a0

Please sign in to comment.