aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Numerlor <[email protected]>2020-11-14 23:34:39 +0100
committerGravatar Numerlor <[email protected]>2020-11-15 03:12:58 +0100
commit15e73b7d4148ff16d2d408eaf201ebd5a6fd1251 (patch)
tree5521f650244a31848c9da2e9ce2c40e569303a10
parentUpdate existing redis values when parsing pages (diff)
Add command for clearing the cache of packages
We also clear the cache when removing a package
-rw-r--r--bot/exts/info/doc/_cog.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/bot/exts/info/doc/_cog.py b/bot/exts/info/doc/_cog.py
index 678134f3c..b2d015b89 100644
--- a/bot/exts/info/doc/_cog.py
+++ b/bot/exts/info/doc/_cog.py
@@ -428,6 +428,7 @@ class DocCog(commands.Cog):
# Rebuild the inventory to ensure that everything
# that was from this package is properly deleted.
await self.refresh_inventory()
+ await doc_cache.delete(package_name)
await ctx.send(f"Successfully deleted `{package_name}` and refreshed inventory.")
@docs_group.command(name="refreshdoc", aliases=("rfsh", "r"))
@@ -450,3 +451,10 @@ class DocCog(commands.Cog):
description=f"```diff\n{added}\n{removed}```" if added or removed else ""
)
await ctx.send(embed=embed)
+
+ @docs_group.command(name="cleardoccache")
+ @commands.has_any_role(*MODERATION_ROLES)
+ async def clear_cache_command(self, ctx: commands.Context, package_name: PackageName) -> None:
+ """Clear persistent redis cache for `package`."""
+ await doc_cache.delete(package_name)
+ await ctx.send(f"Succesfully cleared cache for {package_name}")