Database Manual / Reference / Database Commands / Role Management

invalidateUserCache (database command数据库命令)

Definition定义

invalidateUserCache
Flushes user information from in-memory cache, including removal of each user's credentials and roles. This allows you to purge the cache at any given moment, regardless of the interval set in the userCacheInvalidationIntervalSecs parameter.从内存缓存中刷新用户信息,包括删除每个用户的凭据和角色。这允许您在任何给定时刻清除缓存,而不管userCacheInvalidationIntervalSecs参数中设置的间隔如何。

Compatibility兼容性

This command is available in deployments hosted in the following environments:此命令在以下环境中托管的部署中可用:

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud:云中MongoDB部署的完全托管服务

Important

This command is not supported in M0 and Flex clusters. For more information, see Unsupported Commands.M0和Flex集群不支持此命令。有关详细信息,请参阅不支持的命令

  • MongoDB Enterprise: The subscription-based, self-managed version of MongoDB:MongoDB的基于订阅的自我管理版本
  • MongoDB Community: The source-available, free-to-use, and self-managed version of MongoDB:MongoDB的源代码可用、免费使用和自我管理版本

Syntax语法

The command has the following syntax:该命令具有以下语法:

db.runCommand(
{
invalidateUserCache: 1
}
)

Required Access所需访问权限

You must have privileges that include the invalidateUserCache action on the cluster resource in order to use this command.要使用此命令,您必须具有包括群集资源上的invalidateUserCache操作在内的权限。