Skip to content
This repository was archived by the owner on Aug 15, 2023. It is now read-only.

Commit d75043a

Browse files
author
Stefano Kowalke
committed
Clear system cache
Add a command to clear the system cache Resolves: #71
1 parent 8d7f48d commit d75043a

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

Classes/Command/CacheApiCommandController.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ public function clearAllCachesCommand() {
5959
$this->outputLine('All caches have been cleared.');
6060
}
6161

62+
/**
63+
* Clear system cache
64+
*
65+
* @return void
66+
*/
67+
public function clearSystemCacheCommand() {
68+
$this->cacheApiService->clearSystemCache();
69+
$this->outputLine('System cache has been cleared');
70+
}
6271
/**
6372
* Clear configuration cache (temp_CACHED_..).
6473
*

Classes/Service/CacheApiService.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,15 @@ public function clearConfigurationCache() {
108108
$this->dataHandler->clear_cacheCmd('temp_cached');
109109
}
110110

111+
/**
112+
* Clear the system cache
113+
*
114+
* @return void
115+
*/
116+
public function clearSystemCache() {
117+
$this->dataHandler->clear_cacheCmd('system');
118+
}
119+
111120
/**
112121
* Clear all caches except the page cache.
113122
* This is especially useful on big sites when you can't

Tests/Unit/Service/CacheApiServiceTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,13 @@ public function clearAllExceptPageCacheClearsAllExceptPageCache() {
124124
$GLOBALS['typo3CacheManager'] = $cacheManager;
125125
$this->subject->clearAllExceptPageCache();
126126
}
127+
128+
/**
129+
* @test
130+
* @covers ::clearSystemCache
131+
*/
132+
public function clearSystemCacheClearsSystemCache() {
133+
$this->dataHandlerMock->expects($this->once())->method('clear_cacheCmd')->with('system');
134+
$this->subject->clearSystemCache();
135+
}
127136
}

0 commit comments

Comments
 (0)