One shared cache for files native apps download. The publisher stays the source.
Explore the docs »
Use the cache
·
Report Bug
·
Request Feature
Table of Contents
asset-cache is for developers whose native apps download the same files. One user-wide store holds the bytes, keyed by hash, and the catalog records, keyed by the publisher domain. A grammar package is a catalog on that store: one file per role, not a separate database.
The example key is devcentr.org / grammars / asciidoc / 1.2 / url. The first part is the site that publishes the asset. It is not the name of the app that reads it.
The longer explanation is The publisher as authority.
Build the command, store the example role file, then show the record. put blob prints a sha256: line. show prints the key, the hash, and the authority URL.
dub build --config=cli --compiler=ldc2
.\bin\asset-cache.exe put blob examples/grammars/asciidoc/1.2/url
.\bin\asset-cache.exe put record devcentr.org grammars asciidoc 1.2 url `
--file examples/grammars/asciidoc/1.2/url `
--authority https://devcentr.org/.well-known/asset-cache/v1/records/grammars/asciidoc/1.2/url `
--media-type text/plain `
--meta spec=https://docs.asciidoctor.org/asciidoc/latest/ `
--meta referenceImplementation=https://github.com/asciidoctor/asciidoctor
.\bin\asset-cache.exe show devcentr.org grammars asciidoc 1.2 urlasset-cache help is the full command list. asset-cache doctor prints the store path.
On Windows the default store is %LOCALAPPDATA%\dev-centr\asset-cache. The library and the command use that same directory.
The publisher is the authority. Each record keeps that publisher's URL. A Dev-Centr process can sit in front, fetch on a miss, store the bytes and the record, and serve them. It still reports the publisher URL, and it identifies itself as a cache.
That is different from Nix. A Nix binary cache is the place clients treat as the source. Here the publisher site is the source. You can leave the intermediary unset, or pass --direct, and the client asks the publisher after the local stores.
Dev-Centr is the authority only for namespaces it publishes (its own domain). For every other provider it is only a cache, and it does not rename that provider as if it had created the namespace.
A private override is local/<app>/.... It is never downloaded, and other apps do not read it. Lookup tries the pin, then the provider key.
The library's registry name is asset-cache on code.dlang.org. Version 0.1.0 is not submitted yet. Until a release is on the registry, depend on the git repository:
dependency "asset-cache" version="~>0.1.0" repository="git+https://github.com/dev-centr/asset-cache.git"
Build the command from a clone with dub build --config=cli --compiler=ldc2. Tests are dub test --config=unittest --compiler=ldc2.
OS packages (MSI, winget, Homebrew, deb, rpm) are not in 0.1.0. There is no self-updater. Upgrade by building a newer commit. version prints the version and the build id.
- Runtime: D / LDC
- Help text: prohelp
- Docs: AsciiDoc
- Library registry name: code.dlang.org (
asset-cache, not published in 0.1.0)
Distributed under the MIT License. See LICENSE.
Dev-Centr - devcentr.org - support@devcentr.org
Project link: https://github.com/dev-centr/asset-cache