CacheCommandController
class CacheCommandController extends CommandController (View source)
Command controller for managing caches
NOTE: This command controller will run in compile time (as defined in the package bootstrap)
Properties
protected Request | $request | from CommandController | |
protected Response | $response | from CommandController | |
protected Arguments | $arguments | from CommandController | |
protected string | $commandMethodName | Name of the command method |
from CommandController |
protected ObjectManagerInterface | $objectManager | ||
protected CommandManager | $commandManager | from CommandController | |
protected ConsoleOutput | $output | from CommandController | |
protected CacheManager | $cacheManager | ||
protected LockManager | $lockManager | ||
protected PackageManager | $packageManager | ||
protected Bootstrap | $bootstrap | ||
protected Environment | $environment |
Methods
Resolves and checks the current command method name
Initializes the arguments array of this controller by creating an empty argument object for each of the method arguments found in the designated command method.
Maps arguments delivered by the request object to the local controller arguments.
Forwards the request to another command and / or CommandController.
Calls the specified command method and passes the arguments.
Returns the CLI Flow command depending on the environment
Outputs specified text to the console window You can specify arguments that will be passed to the text via sprintf
Outputs specified text to the console window and appends a line break
Formats the given text to fit into MAXIMUM_LINE_LENGTH and outputs it to the console window
Exits the CLI through the dispatcher and makes sure that Flow is properly shut down.
Sends the response and exits the CLI without any further code execution Should be used for commands that flush code caches.
Flush all caches
Flushes a particular cache by its identifier
Warm up caches
List all configured caches and their status if available
Display details of a cache including a detailed status if available
Setup the given Cache if possible
Setup all Caches
Cache Garbage Collection
Call system function
Signals that caches should be warmed up.
Details
__construct()
Constructs the command controller
void
injectCommandManager(CommandManager $commandManager)
No description
void
injectObjectManager(ObjectManagerInterface $objectManager)
No description
protected string
resolveCommandMethodName()
Resolves and checks the current command method name
Note: The resulting command method name might not have the correct case, which isn't a problem because PHP is case insensitive regarding method names.
protected void
initializeCommandMethodArguments()
Initializes the arguments array of this controller by creating an empty argument object for each of the method arguments found in the designated command method.
protected void
mapRequestArgumentsToControllerArguments()
Maps arguments delivered by the request object to the local controller arguments.
protected void
forward(string $commandName, string $controllerObjectName = null, array $arguments = [])
Forwards the request to another command and / or CommandController.
Request is directly transferred to the other command / controller without the need for a new request.
protected void
callCommandMethod()
Calls the specified command method and passes the arguments.
If the command returns a string, it is appended to the content in the response object. If the command doesn't return anything and a valid view exists, the view is rendered automatically.
string
getFlowInvocationString()
Returns the CLI Flow command depending on the environment
protected void
output(string $text, array $arguments = [])
Outputs specified text to the console window You can specify arguments that will be passed to the text via sprintf
protected void
outputLine(string $text = '', array $arguments = [])
Outputs specified text to the console window and appends a line break
protected void
outputFormatted(string $text = '', array $arguments = [], int $leftPadding = 0)
Formats the given text to fit into MAXIMUM_LINE_LENGTH and outputs it to the console window
protected never
quit(int $exitCode = 0)
Exits the CLI through the dispatcher and makes sure that Flow is properly shut down.
If your command relies on functionality which is triggered through the Bootstrap shutdown (such as the persistence framework), you must use quit() instead of exit().
protected never
sendAndExit(int $exitCode = 0)
Sends the response and exits the CLI without any further code execution Should be used for commands that flush code caches.
void
injectCacheManager(CacheManager $cacheManager)
No description
void
injectLockManager(LockManager $lockManager)
No description
void
injectPackageManager(PackageManager $packageManager)
No description
void
injectBootstrap(Bootstrap $bootstrap)
No description
void
injectEnvironment(Environment $environment)
No description
void
flushCommand(bool $force = false)
Flush all caches
The flush command flushes all caches (including code caches) which have been registered with Flow's Cache Manager. It will NOT remove any session data, unless you specifically configure the session caches to not be persistent.
If fatal errors caused by a package prevent the compile time bootstrap from running, the removal of any temporary data can be forced by specifying the option --force.
This command does not remove the precompiled data provided by frozen packages unless the --force option is used.
void
flushOneCommand(string $identifier)
Flushes a particular cache by its identifier
Given a cache identifier, this flushes just that one cache. To find the cache identifiers, you can use the configuration:show command with the type set to "Caches".
Note that this does not have a force-flush option since it's not meant to remove temporary code data, resulting into a broken state if code files lack.
void
warmupCommand()
Warm up caches
The warm up caches command initializes and fills – as far as possible – all registered caches to get a snappier response on the first following request. Apart from caches, other parts of the application may hook into this command and execute tasks which take further steps for preparing the app for the big rush.
void
listCommand(bool $quiet = false)
List all configured caches and their status if available
This command will exit with a code 1 if at least one cache status contains errors or warnings This allows the command to be easily integrated in CI setups (the --quiet flag can be used to reduce verbosity)
void
showCommand(string $cacheIdentifier)
Display details of a cache including a detailed status if available
void
setupCommand(string $cacheIdentifier)
Setup the given Cache if possible
Invokes the setup() method on the configured CacheBackend (if it implements the WithSetupInterface) which should setup and validate the backend (i.e. create required database tables, directories, ...)
void
setupAllCommand(bool $quiet = false)
Setup all Caches
Invokes the setup() method on all configured CacheBackend that implement the WithSetupInterface interface which should setup and validate the backend (i.e. create required database tables, directories, ...)
This command will exit with a code 1 if at least one cache setup failed This allows the command to be easily integrated in CI setups (the --quiet flag can be used to reduce verbosity)
void
collectGarbageCommand(string $cacheIdentifier = null)
Cache Garbage Collection
Runs the Garbage Collection (collectGarbage) method on all registered caches.
Though the method is defined in the BackendInterface, the implementation can differ and might not remove any data, depending on possibilities of the backend.
void
sysCommand(int $address)
Call system function
void
emitWarmupCaches()
Signals that caches should be warmed up.
Other application parts may subscribe to this signal and execute additional tasks for preparing the application for the first request.