# std.cache_hash: break up the API and improve implementation · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/1baa56a25f7b4cf7b3e0a78ded90c432a40c4efa)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 1baa56a25f7b4cf7b3e0a78ded90c432a40c4efa

Requested commit: 1baa56a25f7b4cf7b3e0a78ded90c432a40c4efa

Commit: 1baa56a25f7b4cf7b3e0a78ded90c432a40c4efa

Tree: 631b636a5ec792aa063e3092f20be06d2c7180fd

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
std.cache_hash: break up the API and improve implementation

into smaller exposed components and expose all of them. This makes it
more flexible.

`*const Cache` is now passed in with an open manifest dir handle which
the caller is responsible for managing.

Expose some of the base64 stuff.

Extract the hash helper functions into `HashHelper` and add some more
methods such as addOptional and addListOfFiles.

Add `CacheHash.toOwnedLock` so that you can deinitialize everything
except the open file handle which represents the file system lock on the
build artifacts.

Use ArrayListUnmanaged, saving space per allocated CacheHash.

Avoid 1 memory allocation in hit() with a static buffer.

hit() returns a bool; caller code is responsible for calling final() in
either case. This is a simpler and easier to use API.

writeManifest() is no longer called from deinit() with errors ignored.

```

## Parents

- [af4cc20ce275aeb0e59eee3d893b2f310c1f0239](https://git.cafe/gitcafe/zig/commit/af4cc20ce275aeb0e59eee3d893b2f310c1f0239?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/1baa56a25f7b4cf7b3e0a78ded90c432a40c4efa?format=markdown)
