import { LibsqlCacheAdapter } from "@daiso-tech/core/lock/implementations/adapters";
import { createClient } from "@libsql/client";
(async () => {
const database = createClient({ url: "file:local.db" });
const lockAdapter = new LibsqlCacheAdapter({
database,
rootGroup: "@global"
});
await lockAdapter.init();
})();
The withGroup method returns a new IDatabaseLockAdapter instance that groups locks together. Only locks in the same group will be acquired and released, leaving locks outside the group unaffected.
To utilize the LibsqlLockAdapter, you must install the "@libsql/client" package.
Note in order to use LibsqlLockAdapter correctly, ensure you use a single, consistent database across all server instances. This means you can't use libsql embedded replicas.
IMPORT_PATH:
"@daiso-tech/core/lock/implementations/adapters"