Skip to content

Commit 8c62b2c

Browse files
tommyknowsAzuka
authored andcommitted
add cache clearing methods (#16)
1 parent 36fecb6 commit 8c62b2c

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

keycloak/realm_service.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,30 @@ func (rs *RealmService) Create(ctx context.Context, realm *RealmRepresentation)
4646
return err
4747
}
4848

49+
// Clear a realm's user cache
50+
func (rs *RealmService) ClearUserCache(ctx context.Context, realm string) error {
51+
path := "/{realm}/clear-user-cache"
52+
_, err := rs.client.newRequest(ctx).
53+
SetPathParams(map[string]string{
54+
"realm": realm,
55+
}).
56+
Post(path)
57+
58+
return err
59+
}
60+
61+
// Clear a realm's cache
62+
func (rs *RealmService) ClearCache(ctx context.Context, realm string) error {
63+
path := "/{realm}/clear-realm-cache"
64+
_, err := rs.client.newRequest(ctx).
65+
SetPathParams(map[string]string{
66+
"realm": realm,
67+
}).
68+
Post(path)
69+
70+
return err
71+
}
72+
4973
// Delete realm with realm name (not id!)
5074
func (rs *RealmService) Delete(ctx context.Context, realm string) error {
5175

0 commit comments

Comments
 (0)