Provider for caching user information to optimize repeated lookups.

interface IUserInfoCacheProvider {
    clear(): Promise<void>;
    getUserInfo(id: string, type?: null | string): Promise<null | IUserInfo>;
    getUsersInfo(ids: string[], type?: null | string): Promise<IUserInfo[]>;
    setUserInfo(info: IUserInfo, type?: null | string): Promise<void>;
    setUsersInfo(info: IUserInfo[], type?: null | string): Promise<void>;
}

Implemented by

Methods

  • Clears all cached user information.

    Returns Promise<void>

  • Retrieves cached user information for single user with specified identifier.

    Parameters

    • id: string

      The user identifier.

    • Optionaltype: null | string

      Optional user info handler type. If null, the default handler is used.

    Returns Promise<null | IUserInfo>

    User information or null user not found by identifier.

  • Retrieves cached user information for multiple users with specified identifiers.

    Parameters

    • ids: string[]

      A collection of the user identifiers.

    • Optionaltype: null | string

      Optional user info handler type. If null, the default handler is used.

    Returns Promise<IUserInfo[]>

    A collection of user information for users that are found.

  • Caches a single user information object.

    Parameters

    • info: IUserInfo

      Basic user information.

    • Optionaltype: null | string

      Optional user info handler type. If null, the default handler is used.

    Returns Promise<void>

  • Caches multiple user information objects.

    Parameters

    • info: IUserInfo[]

      A collection of basic user informations.

    • Optionaltype: null | string

      Optional user info handler type. If null, the default handler is used.

    Returns Promise<void>