From 0b6d5dcdc8bbb36aca265a35a117d5f0042e5b14 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 15 May 2025 16:00:40 +0200 Subject: [PATCH] feat: add command to delete memcache key Signed-off-by: Robin Appelman --- core/Command/Memcache/DistributedDelete.php | 43 +++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 core/Command/Memcache/DistributedDelete.php diff --git a/core/Command/Memcache/DistributedDelete.php b/core/Command/Memcache/DistributedDelete.php new file mode 100644 index 00000000000..ae0855acb03 --- /dev/null +++ b/core/Command/Memcache/DistributedDelete.php @@ -0,0 +1,43 @@ +setName('memcache:distributed:delete') + ->setDescription('Delete a value in the distributed memcache') + ->addArgument('key', InputArgument::REQUIRED, 'The key to delete'); + parent::configure(); + } + + protected function execute(InputInterface $input, OutputInterface $output): int { + $cache = $this->cacheFactory->createDistributed(); + $key = $input->getArgument('key'); + if ($cache->remove($key)) { + $output->writeln('Distributed cache key ' . $key . ' deleted'); + return 0; + } else { + $output->writeln('Failed to delete cache key ' . $key . ''); + return 1; + } + } +}