Clear User Cache
Audience:
Low-code EngineersSkill Prerequisites:
Actions,User management
Removes DNN's cached copy of a user, so the user is read fresh from the database the next time they're needed.
It can clear the user in User, the current user, or both. The current user is the logged-in user, or the user set by Load User or Change User.
Typical Use Cases
- Show a user's new data after changing user or role tables directly with Run SQL Query
- Refresh a user after Sync Users added them to other portals
- Make sure
[User:*]tokens and role checks use fresh data for a user that was just changed
Don't use it to
- Clear other cached data, such as pages or portal settings. Use Clear Cache Item instead.
- Clear the cache of every user in the context's list. Only the current user is cleared, see Considerations.
Related Actions
| Action Name | Description |
|---|---|
| Clear Cache Item | Clears other items from the server cache, or the whole cache. |
| Load User | Makes a user the current user. |
| Change User | Changes the current user for the actions that follow. |
| Run SQL Query | Changes data directly, which may leave old user data in the cache. |
| Sync Users | Shares users between portals without clearing the cache. |
| Update User Profile | Updates a user through DNN, which refreshes the cache itself. |
Input Parameter Reference
The parameters unique to this action are listed below. Review the common parameters for all actions here.
| Parameter | Description | Supports Tokens | Default | Required |
|---|---|---|---|---|
| User | The user to clear, as a user ID, email or username, for example [UserId]. A number is treated as a user ID. Otherwise it's matched against emails first, then usernames, on the current portal. If no user is found, the action fails. | Yes | empty string | No |
| Clear the cache for the current context user | Also clears the current user. | No | false | No |
If both are set, both users are cleared. If neither is set, the action does nothing.
Output Parameters Reference
This action doesn't create any tokens.
How it works
The user's cache is cleared on the current portal. If the user was created on a different portal, it's cleared on that portal too.
In User Guides
User Guides has its own, older copy of this action, with the same ID and parameters. It clears the same cache, with two differences:
- The checkbox is labeled Clear users loaded in context. It still clears only the current user.
- If no user matches User, it's skipped without an error.
Considerations
- Only one user from the context. Despite older help text, the checkbox clears only the current user, not every user loaded with Load User or Load Users from SQL. To clear several users, run the action once per user with User set, for example inside Repeat.
- You don't always need it. Actions that change users through DNN, such as Update User Profile, already refresh the cache. Use this action after changes made outside DNN, such as SQL.
- Empty after tokens. If User holds a token that turns out empty, the action fails because no user matches.
Examples
To understand how to use the below examples, please see Running Examples.
1. Refresh a user after changing roles with SQL
This action clears the cache of the user whose ID is in the UserId token, for example after a Run SQL Query action added rows to the UserRoles table.
{
"Title": "Clear User Cache",
"ActionType": "ClearUserCache",
"Description": "Refresh the user after the SQL update",
"Parameters": {
"UserToken": "[UserId]",
"ClearUsersFromContext": false
}
}
2. Refresh the current user
This action clears the cache of the current user, for example the logged-in user after their profile was changed with SQL.
{
"Title": "Clear User Cache",
"ActionType": "ClearUserCache",
"Description": "Refresh the current user",
"Parameters": {
"UserToken": "",
"ClearUsersFromContext": true
}
}
Revised 09/28/2026