clear role cache on save

This commit is contained in:
sadnub 2022-04-10 10:46:47 -04:00
parent 7cb16b2259
commit c02ab50a0a
1 changed files with 6 additions and 0 deletions

View File

@ -197,6 +197,12 @@ class Role(BaseAuditModel):
def __str__(self):
return self.name
def save(self, *args, **kwargs) -> None:
# delete cache on save
cache.delete(f"{ROLE_CACHE_PREFIX}{self.name}")
super(BaseAuditModel, self).save(*args, **kwargs)
@staticmethod
def serialize(role):
# serializes the agent and returns json