You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Building on the work in PR git-lfs#6047, we implement a common LRU cache
for the Filter structure in our "filepathfilter" package, which is
used by all commands that accept command-line or configuration
options to filter their actions by file paths.
Specifically, any of our commands which accept --include or --exclude
options (or their -I and -X short forms), or read the "lfs.fetchInclude"
and "lfs.fetchExclude" configuration options, should benefit from
the use of a cache to return previously-determined results when
matching file paths against the file path filter patterns.
We set the default cache size at 10,000 entries, and provide a new
"lfs.pathFilterCacheSize" configuration option which may be used to
resize the cache as desired. The special values "none" and "0" disable
the cache, and the value "unlimited" allows the cache to grow without
bound.
Note that to pass the cache size setting to the "filepathfilter"
package we rename its "option" type to "Option" so it will be
exported and available from our "commands" package.
We use the Least-Recently Used (LRU) cache implemention from the
"golang/groupcache" Go module, which used a map plus a doubly-linked
list to track the most- and least-recently used entries. We add a
mutex around our accesses to the cache in case any of our commands
use the Allows() method of the Filter structure from concurrent
goroutines.
0 commit comments