Skip to content

Commit 349a920

Browse files
committed
chore: docs wip
1 parent 0e6b7e2 commit 349a920

29 files changed

Lines changed: 284 additions & 1514 deletions

README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,33 @@
1616

1717
See documentation at [verrou.dev](https://verrou.dev/docs/introduction)
1818

19-
## Why Verrou ?
19+
## Why Verrou ?
2020

21-
Simply because there is no alternative in the Javascript Ecosystem. Main goal of Verrou is to provide a simple and unified API to use locks, no matter the driver. It brings some benefits, like being able to switch from one driver to another without changing your code. Also being able to switch to an in-memory driver in test environment to make your tests faster and easier to write ( No infrastructure to setup ).
21+
Main advantage of Verrou is that it provides a consistent API across all drivers. This means that you can switch from one driver to another without having to change your code. It also means you can switch to an in-memory in your test environment, making tests faster and easier to setup (no infrastructure or anything fancy to setup).
2222

23-
We also provide a modern API, using `async/await` and `using` to make your code sexy and easy to read.
23+
Having a consistent API also means that you don't have to learn a new API when switching from one driver to another. Today, in the node ecosystem, we have different npm packages to manage locks, but they all have differents APIs and behaviors.
24+
25+
But having a consistent API doesn't mean having a less powerful API. Verrou provides every features you would expect from a locking library, and even more.
2426

2527
## Basic usage
2628

2729
```ts
28-
import { Verrou } from 'verrou'
29-
import { redisStore } from 'verrou/drivers/redis'
30-
import { memoryStore } from 'verrou/drivers/memory'
30+
import { Verrou } from '@verrou/core'
31+
import { redisStore } from '@verrou/core/drivers/redis'
32+
import { memoryStore } from '@verrou/core/drivers/memory'
3133

32-
const lock = new Verrou({
34+
const verrou = new Verrou({
3335
default: 'redis',
3436
drivers: {
35-
redis: redisStore(),
36-
memory: memoryStore()
37+
redis: { driver: redisStore() },
38+
memory: { driver: memoryStore() }
3739
}
3840
})
3941

40-
// Lock a resource
41-
await lock.createLock('my-resource').run(async () => {
42+
// Lock a resource and run a function
43+
await verrou.createLock('my-resource').run(async () => {
4244
await doSomething()
43-
}) // Lock is automatically released after the callback
45+
}) // Lock is automatically released
4446
```
4547

4648
## Sponsor
-74.4 KB
Binary file not shown.

docs/content/docs/cache_drivers.md

Lines changed: 0 additions & 243 deletions
This file was deleted.

docs/content/docs/db.json

Lines changed: 6 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -12,63 +12,9 @@
1212
"category": "Guides"
1313
},
1414
{
15-
"permalink": "walkthrough",
16-
"title": "Walkthrough",
17-
"contentPath": "./walkthrough.md",
18-
"category": "Guides"
19-
},
20-
{
21-
"permalink": "options",
22-
"title": "Options",
23-
"contentPath": "./options.md",
24-
"category": "Guides"
25-
},
26-
{
27-
"permalink": "cache-drivers",
28-
"title": "Cache drivers",
29-
"contentPath": "./cache_drivers.md",
30-
"category": "Guides"
31-
},
32-
{
33-
"permalink": "multi-tier",
34-
"title": "Multi-Tier",
35-
"contentPath": "./multi_tier.md",
36-
"category": "Guides"
37-
},
38-
{
39-
"permalink": "methods",
40-
"title": "Methods",
41-
"contentPath": "./methods.md",
42-
"category": "Guides"
43-
},
44-
{
45-
"permalink": "namespaces",
46-
"title": "Namespaces",
47-
"contentPath": "./namespaces.md",
48-
"category": "Guides"
49-
},
50-
{
51-
"permalink": "named-caches",
52-
"title": "Named caches",
53-
"contentPath": "./named_caches.md",
54-
"category": "Guides"
55-
},
56-
{
57-
"permalink": "grace-periods",
58-
"title": "Grace periods",
59-
"contentPath": "./grace_periods.md",
60-
"category": "Guides"
61-
},
62-
{
63-
"permalink": "timeouts",
64-
"title": "Timeouts",
65-
"contentPath": "./timeouts.md",
66-
"category": "Guides"
67-
},
68-
{
69-
"permalink": "stampede-protection",
70-
"title": "Stampede protection",
71-
"contentPath": "./stampede_protection.md",
15+
"permalink": "drivers",
16+
"title": "Drivers",
17+
"contentPath": "./drivers.md",
7218
"category": "Guides"
7319
},
7420
{
@@ -84,27 +30,9 @@
8430
"category": "Digging Deeper"
8531
},
8632
{
87-
"permalink": "plugin-prometheus",
88-
"title": "Prometheus",
89-
"contentPath": "./plugins/prometheus.md",
90-
"category": "Plugins"
91-
},
92-
{
93-
"permalink": "custom-cache-driver",
94-
"title": "Create a custom cache driver",
95-
"contentPath": "./extend/custom_cache_driver.md",
96-
"category": "Extend"
97-
},
98-
{
99-
"permalink": "custom-bus-driver",
100-
"title": "Create a custom bus driver",
101-
"contentPath": "./extend/custom_bus_driver.md",
102-
"category": "Extend"
103-
},
104-
{
105-
"permalink": "create-plugin",
106-
"title": "Create a plugin",
107-
"contentPath": "./extend/create_plugin.md",
33+
"permalink": "custom-lock-store",
34+
"title": "Create a custom lock store",
35+
"contentPath": "./extend/custom_lock_store.md",
10836
"category": "Extend"
10937
}
11038
]

0 commit comments

Comments
 (0)