Class

CacheService

CacheService()

Lightweight caching helpers backed by Redis.

Constructor

# new CacheService()

View Source utils/cache.utils.js, line 7

Methods

# async static addUser(user) → {Promise.<void>}

Add user to Redis cache.

Parameters:
Name Type Description
user ICurrentUserResponse

The user to add to the cache.

View Source utils/cache.utils.js, line 39

Resolves when the cache entry is stored.

Promise.<void>

# async static deleteUser(userId) → {Promise.<void>}

Delete user from Redis cache

Parameters:
Name Type Description
userId string

The user ID to delete from the cache

View Source utils/cache.utils.js, line 71

Resolves when the user is deleted from the cache.

Promise.<void>

# static generateKey(userId) → {string}

Generate key for Redis cache.

Parameters:
Name Type Description
userId string

The user ID.

View Source utils/cache.utils.js, line 15

Redis key namespace.

string

# static toUserResponse(user) → {ICurrentUserResponse}

Transform User document to ICurrentUserResponse format.

Parameters:
Name Type Description
user IUserDocument

The user to transform.

View Source utils/cache.utils.js, line 23

Serialized user response.

ICurrentUserResponse

# async static updateUser(user) → {Promise.<void>}

Update user in Redis cache.

Parameters:
Name Type Description
user ICurrentUserResponse

The user to update in the cache.

View Source utils/cache.utils.js, line 53

Resolves when potential cache updates finish.

Promise.<void>