@robby-rabbitman/nx-plus-nx-http-cache
v0.10.0
Published
HTTP handler for integrating custom cache solutions in Nx workspaces.
Maintainers
Readme
@robby-rabbitman/nx-plus-nx-http-cache
A http handler that implements the Nx Remote Caching OpenAPI for integrating a custom cache solution.
Checkout the azurite blob storage example.
Usage
import { createServer } from 'http';
import {
nxHttpCacheHandler,
NxCache,
} from '@robby-rabbitman/nx-plus-nx-http-cache';
// TODO: make sure to implement your caching solution
class MyCache
implements
NxCache
{
get: (
hash: string,
) => Promise<Buffer>;
has: (
hash: string,
) => Promise<boolean>;
set: (
hash: string,
data: Buffer,
) => Promise<void>;
}
const server =
createServer(
nxHttpCacheHandler(
new MyCache(),
{
readAccessToken:
'my-read-access-token',
writeAccessToken:
'my-write-access-token',
},
),
);
server.listen(
3000,
);