- 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,pullandpush) can take a "long" time for large git repositories.The
cacheparameterUnlike canonical
gitcommands however, there is a way forgit-essentialscommands 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:
cacheobject.cachedirectly 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.