invalidateCacheForUser static method

Future<void> invalidateCacheForUser(
  1. Session session,
  2. int userId
)

Invalidates the cache for a user and makes sure the next time a user info is fetched it's fresh from the database.

Implementation

static Future<void> invalidateCacheForUser(
    Session session, int userId) async {
  var cacheKey = 'serverpod_auth_userinfo_$userId';
  await session.caches.local.invalidateKey(cacheKey);
}