Skip to content

Commit d71e6b7

Browse files
committed
Finalize caching.
1 parent 3217b61 commit d71e6b7

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

src/actor.ts

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ async function getKeys(this: Actor): Promise<PublicKeysResult | Error> {
9090

9191
export class Actor extends Observer {
9292
public keys = cached(locked(getKeys), "keys")
93+
9394
public backend: Backend
9495
public actor: string
9596
public id: string

src/provider/check-data.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe("Provider.checkData()", function () {
2121
await resetDB(be, keys)
2222
const med = await mediator(be, keys)
2323
const vp = await verifiedProvider(be, keys, med)
24-
const result = await vp.checkData({})
24+
const result = await vp.checkData().get({})
2525

2626
if (result.status === Status.Failed)
2727
throw new Error("cannot get confirmed data")

src/provider/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ export * from "./helpers"
2929

3030
export class Provider extends Actor {
3131
public backupData = locked(backupData)
32-
public checkData = locked(checkData)
3332
public storeData = locked(storeData)
3433
public restoreFromBackup = locked(restoreFromBackup)
3534
public publishAppointments = locked(publishAppointments)
3635
public generateKeyPairs = locked(generateKeyPairs)
36+
37+
// cached endpoints
38+
public checkData = cached(locked(checkData), "checkData")
3739
public appointments = cached(locked(getAppointments), "appointments")
3840

3941
// helper/convenience functions

src/user/index.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ export class User extends Actor {
3030
public cancelAppointment = locked(cancelAppointment)
3131
public generateKeyPairs = locked(generateKeyPairs)
3232
public bookAppointment = locked(bookAppointment)
33-
public appointments = cached(locked(getAppointments), "appointments")
34-
public appointment = cached(locked(getAppointment), "appointment")
3533
public backupData = locked(backupData)
3634
public getToken = locked(getToken)
3735

36+
// cached endpoints
37+
public appointments = cached(locked(getAppointments), "appointments")
38+
public appointment = cached(locked(getAppointment), "appointment")
39+
3840
private generateSecret() {
3941
this.secret = buf2base32(b642buf(randomBytes(10)))
4042
}

0 commit comments

Comments
 (0)