Clear cache command

Clear cache command

The way AppMail works in most cases where performance is important, is that it fetches the data from the database once, then it will store it in cache and serve it from there for as much as possible.
This allows AppMail to perform fast because data access from the cache is very fast.

However, there are times when the application cache must be cleared, one such example is after doing a AppMail version update. When this happens, AppMail will try to clear the cache by itself, so that any new changes in the new version are reflected properly. If AppMail fails to do this, for any reason, then you might need to do it manually using the clear-cache command.

An example of this situation was after an update to v2.1.3, when trying to create a campaign, some instances of AppMail got this error: "CampaignOption.email_stats_delay_days" is not defined. The v2.1.2 version introduced a new column in the database and since the cache was not properly regenerated, the old cache for the database schema was not reflecting the new column, so it was reported as not found. Clearing the cache manually fixed the problem.

The command has the following signature:

command: /usr/bin/php -q {ABSOLUTE_PATH_TO}/apps/console/console.php clear-cache --verbose=1
--verbose=1 whether to show output in the console.

So, a valid call to this command will look like:

/usr/bin/php -q /var/www/html/apps/console/console.php clear-cache --verbose=1

Since running this command will clear the application cache, the application will be slower for a while until the cache is regenerated.

You should not abuse this command, only run it when it is really needed, preferably when the application is not busy and when no campaigns are going out.

    • Related Articles

    • Campaign grid stats cache warmup command

      Starting with version 2.1.2 we introduced the campaign-grid-stats-cache-warmup command which will keep up-to-date the cache for the stats shown in the campaigns grid view. The command has the following signature: command: /usr/bin/php -q ...
    • Using Redis for cache and mutexes

      Since AppMail 1.5.0 is possible to use Redis for the cache and mutex components. In order to do this, after you install and setup redis, you have to open the apps/common/config/main-custom.php file and add the following components into it: ...
    • Debug send-campaigns command

      Starting with version 1.3.5, the cron job command that sends campaigns (send-campaigns) has been modified so that it will help debugging sending speed. In order to make use of this functionality, you should have ssh access to your server so that you ...
    • Delete campaigns command

      Deleting old campaigns, that you don't need anymore, will free up a lot of disk space. This in turn will result in a faster application because there will be less data AppMail has to go through in order to complete operations. The delete-campaigns ...
    • Move inactive subscriber's command

      Starting with version 1.3.7.1 we introduced the move-inactive-subscribers command which will move subscribers that did not open a campaign or did not click a link in a campaign in a given period of time. The command has the following signature: ...