Typings
This commit is contained in:
parent
7133fc0a13
commit
d63c5830e5
|
@ -69,7 +69,7 @@ async function populateUsersFromDB(
|
||||||
export async function getUser(
|
export async function getUser(
|
||||||
userId: string,
|
userId: string,
|
||||||
tenantId?: string,
|
tenantId?: string,
|
||||||
populateUser?: any
|
populateUser?: (userId: string, tenantId: string) => Promise<User>
|
||||||
) {
|
) {
|
||||||
if (!populateUser) {
|
if (!populateUser) {
|
||||||
populateUser = populateFromDB
|
populateUser = populateFromDB
|
||||||
|
@ -83,7 +83,7 @@ export async function getUser(
|
||||||
}
|
}
|
||||||
const client = await redis.getUserClient()
|
const client = await redis.getUserClient()
|
||||||
// try cache
|
// try cache
|
||||||
let user = await client.get(userId)
|
let user: User = await client.get(userId)
|
||||||
if (!user) {
|
if (!user) {
|
||||||
user = await populateUser(userId, tenantId)
|
user = await populateUser(userId, tenantId)
|
||||||
await client.store(userId, user, EXPIRY_SECONDS)
|
await client.store(userId, user, EXPIRY_SECONDS)
|
||||||
|
|
Loading…
Reference in New Issue