- Preparing search index...
- The search index is not available
git-essentials
Cache
: { Â Â Â Â [IndexCache]
?: { Â Â Â Â Â Â Â Â map
: Map<string, GitIndex>; Â Â Â Â Â Â Â Â stats
: Map<string, Stats | null>; Â Â Â Â }; Â Â Â Â [PackfileCache]
?: Map<string, Promise<GitPackIndex | undefined>>; }
Type declaration
-
Optional
[IndexCache]?: {
    map: Map<string, GitIndex>;
    stats: Map<string, Stats | null>;
}
-
Optional
[PackfileCache]?: Map<string, Promise<GitPackIndex | undefined>>
Some Git commands can greatly benefit from a cache. Reading and parsing git packfiles (the files sent over the wire during
clone
,fetch
,pull
andpush
) can take a "long" time for large git repositories.The
cache
parameterUnlike canonical
git
commands however, there is a way forgit-essentials
commands to cache intermediate results and re-use them between commands.There is no single best caching strategy:
Instead of compromising, the library have placed a powerful tool in your hands:
cache
object.cache
directly will void your warranty.Example
The catch of course, is you have to decide when (if ever) to get rid of that cache. It is just a JavaScript object, so all you need to do is eliminate any references to it and it will be garbage collected.