File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+ /**
5+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
6+ * SPDX-License-Identifier: AGPL-3.0-or-later
7+ */
8+
9+ namespace OC \Core \Command \Memcache ;
10+
11+ use OC \Core \Command \Base ;
12+ use OCP \ICacheFactory ;
13+ use Symfony \Component \Console \Input \InputArgument ;
14+ use Symfony \Component \Console \Input \InputInterface ;
15+ use Symfony \Component \Console \Output \OutputInterface ;
16+
17+ class DistributedDelete extends Base {
18+ public function __construct (
19+ protected ICacheFactory $ cacheFactory ,
20+ ) {
21+ parent ::__construct ();
22+ }
23+
24+ protected function configure (): void {
25+ $ this
26+ ->setName ('memcache:distributed:delete ' )
27+ ->setDescription ('Delete a value in the distributed memcache ' )
28+ ->addArgument ('key ' , InputArgument::REQUIRED , 'The key to delete ' );
29+ parent ::configure ();
30+ }
31+
32+ protected function execute (InputInterface $ input , OutputInterface $ output ): int {
33+ $ cache = $ this ->cacheFactory ->createDistributed ();
34+ $ key = $ input ->getArgument ('key ' );
35+ if ($ cache ->remove ($ key )) {
36+ $ output ->writeln ('<info>Distributed cache key <info> ' . $ key . '</info> deleted</info> ' );
37+ return 0 ;
38+ } else {
39+ $ output ->writeln ('<error>Failed to delete cache key ' . $ key . '</error> ' );
40+ return 1 ;
41+ }
42+ }
43+ }
Original file line number Diff line number Diff line change 6969use OC \Core \Command \Maintenance \UpdateHtaccess ;
7070use OC \Core \Command \Maintenance \UpdateTheme ;
7171use OC \Core \Command \Memcache \RedisCommand ;
72+ use OC \Core \Command \Memcache \DistributedDelete ;
7273use OC \Core \Command \Memcache \DistributedGet ;
7374use OC \Core \Command \Memcache \DistributedSet ;
7475use OC \Core \Command \Memcache \RedisCommand ;
248249 $ application ->add (Server::get (Statistics::class));
249250
250251 $ application ->add (Server::get (RedisCommand::class));
252+ $ application ->add (Server::get (DistributedDelete::class));
251253 $ application ->add (Server::get (DistributedGet::class));
252254 $ application ->add (Server::get (DistributedSet::class));
253255} else {
Original file line number Diff line number Diff line change 12931293 'OC \\Core \\Command \\Maintenance \\RepairShareOwnership ' => $ baseDir . '/core/Command/Maintenance/RepairShareOwnership.php ' ,
12941294 'OC \\Core \\Command \\Maintenance \\UpdateHtaccess ' => $ baseDir . '/core/Command/Maintenance/UpdateHtaccess.php ' ,
12951295 'OC \\Core \\Command \\Maintenance \\UpdateTheme ' => $ baseDir . '/core/Command/Maintenance/UpdateTheme.php ' ,
1296+ 'OC \\Core \\Command \\Memcache \\DistributedDelete ' => $ baseDir . '/core/Command/Memcache/DistributedDelete.php ' ,
12961297 'OC \\Core \\Command \\Memcache \\DistributedGet ' => $ baseDir . '/core/Command/Memcache/DistributedGet.php ' ,
12971298 'OC \\Core \\Command \\Memcache \\DistributedSet ' => $ baseDir . '/core/Command/Memcache/DistributedSet.php ' ,
12981299 'OC \\Core \\Command \\Memcache \\RedisCommand ' => $ baseDir . '/core/Command/Memcache/RedisCommand.php ' ,
Original file line number Diff line number Diff line change @@ -1334,6 +1334,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
13341334 'OC \\Core \\Command \\Maintenance \\RepairShareOwnership ' => __DIR__ . '/../../.. ' . '/core/Command/Maintenance/RepairShareOwnership.php ' ,
13351335 'OC \\Core \\Command \\Maintenance \\UpdateHtaccess ' => __DIR__ . '/../../.. ' . '/core/Command/Maintenance/UpdateHtaccess.php ' ,
13361336 'OC \\Core \\Command \\Maintenance \\UpdateTheme ' => __DIR__ . '/../../.. ' . '/core/Command/Maintenance/UpdateTheme.php ' ,
1337+ 'OC \\Core \\Command \\Memcache \\DistributedDelete ' => __DIR__ . '/../../.. ' . '/core/Command/Memcache/DistributedDelete.php ' ,
13371338 'OC \\Core \\Command \\Memcache \\DistributedGet ' => __DIR__ . '/../../.. ' . '/core/Command/Memcache/DistributedGet.php ' ,
13381339 'OC \\Core \\Command \\Memcache \\DistributedSet ' => __DIR__ . '/../../.. ' . '/core/Command/Memcache/DistributedSet.php ' ,
13391340 'OC \\Core \\Command \\Memcache \\RedisCommand ' => __DIR__ . '/../../.. ' . '/core/Command/Memcache/RedisCommand.php ' ,
You can’t perform that action at this time.
0 commit comments