Skip to content

Commit df5bb38

Browse files
committed
readme
1 parent 60faec9 commit df5bb38

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

README.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,24 @@ When running E2E tests in parallel, you might need to:
1616
✅ Authenticate user only once\
1717
✅ Seed database only once\
1818
✅ Compute heavy values on demand\
19-
✅ Reuse those values across workers\
20-
✅ Persist some values between test runs
19+
✅ Reuse heavy-computed values across workers\
20+
✅ Persist heavy-computed values between test runs
2121

2222
Global Cache makes all of this possible.
2323

24-
## How it works
24+
## How it works?
2525

2626
The first worker that requests a value becomes responsible for computing it. Others wait until the result is ready — and all workers get the same value. The value is cached in memory or on the filesystem and reused by subsequent workers and test runs:
2727

28-
<img align="center" alt="Global cache schema" src="https://raw.githubusercontent.com/vitalets/global-cache/refs/heads/main/scripts/img/schema-1628.png" />
28+
<p align="center">
29+
<img alt="Global cache schema" src="https://raw.githubusercontent.com/vitalets/global-cache/refs/heads/main/scripts/img/schema-1628.png" />
30+
</p>
31+
32+
<details><summary>What happens under the hood?</summary>
33+
34+
Under the hood, Global Cache spins up a tiny HTTP server, with a simple REST API for getting and setting values. This server is a single storage point for all workers. When a worker needs a value, it performs a `GET` request to the server, and either gets a cached value instantly or computes the value and sets it via the `POST` request.
35+
36+
</details>
2937

3038
## Index
3139

@@ -59,7 +67,7 @@ The first worker that requests a value becomes responsible for computing it. Oth
5967
* [Debug](#debug)
6068
* [Changelog](#changelog)
6169
* [FAQ](#faq)
62-
* [How to use Global Cache in AfterAll hook?](#how-to-use-global-cache-in-afterall-hook)
70+
* [How to use Global Cache in the AfterAll hook?](#how-to-use-global-cache-in-the-afterall-hook)
6371
* [Feedback](#feedback)
6472
* [License](#license)
6573

@@ -71,7 +79,7 @@ Currently Global Cache is primarily developed for [Playwright](https://playwrigh
7179

7280
### Install
7381

74-
Install via any package manager:
82+
Install via any package manager. For example, npm:
7583

7684
```sh
7785
npm i -D @global-cache/playwright
@@ -83,17 +91,16 @@ Enable Global Cache in the `playwright.config.ts`:
8391

8492
```ts
8593
import { defineConfig } from '@playwright/test';
86-
import { globalCache } from '@global-cache/playwright';
94+
import { globalCache } from '@global-cache/playwright'; // <-- import global cache
8795

8896
const config = defineConfig({
89-
// ...your Playwright config
97+
// ...
9098
});
9199

92-
export default globalCache.wrap(config);
100+
export default globalCache.wrap(config); // <-- wrap Playwright config
93101
```
94102

95-
<details>
96-
<summary>Manual configuration</summary>
103+
<details><summary>Manual configuration</summary>
97104

98105
You can manually adjust Playwright config to enable Global Cache:
99106

0 commit comments

Comments
 (0)