Guys, can we create a new command:
cache on/off

I am constantly switching on/off my mysql caches and it is the most visited page lately...

If such a request gets some support from the community I am ready to share my ideas for the exact syntax....

PS. In another thread we should discuss the general strategy of making drush more like a faster UI for the Drupal system - I mean - sooner or later drush will have all functions that the drupal frontend has... Do you realize this?

Comments

moshe weitzman’s picture

i suggest using sql query command to disable query cache. drupal page cache maybe disabled with new vset command. it might make sense to add a specific cache related command - not sure.

moshe weitzman’s picture

Status: Active » Closed (won't fix)

lets rely on vset for now.

doublejosh’s picture

Component: Code » PM (dl, en, up ...)

For other folks who might be wondering like I was...

drush vset cache 0

Then choose 1.

rbayliss’s picture

Status: Closed (won't fix) » Needs review
StatusFileSize
new2.17 KB

Funny this issue got bumped recently. I wrote some shortcut commands for enabling and disabling the different caches a couple weeks ago and have found myself using them a lot. I hate to revive a dead issue, but this simple functionality saves a lot of time during development. I think this patch should cover it if you'd like to reconsider.

greg.1.anderson’s picture

Didn't test yet, but the code looks good. I'm in favor of committing this here, but if moshe doesn't want it, I'll take it in drush_extras.

msonnabaum’s picture

I could go either way on this functionality, but it's incomplete as is. Page cache isn't on/off, there are 3 potential values there (4 if you're on pressflow), so those should be represented as well.

rbayliss’s picture

Thanks for the feedback. Rerolled the patch to have an option for page cache, and also to be more flexible in how variables and values are specified. I'm looking at the negative value devel module's devel_rebuild_theme_registry as an example of where this could be useful. Also, I'm not sure what level of support Drush wants to maintain for Pressflow, but using 'external' for a page cache option will currently work.

msonnabaum’s picture

Maybe you could check if the CACHE_EXTERNAL constant is defined and only display it then?

rbayliss’s picture

Good idea. It's not a display issue, since it's an option, but I don't think anything good would come of a non-pressflow site being set to cache external.

moshe weitzman’s picture

Status: Needs review » Needs work

This actually looks pretty nice to me now. Needs unit tests. See the /tests directory for examples.

rsvelko’s picture

hooray - I knew it on August 28, 2009 at 6:30pm :) !

robloach’s picture

+++ b/commands/core/cache.drush.incundefined
@@ -42,6 +42,29 @@ function cache_drush_command() {
+  $items['cache-disable'] = array(
+    'description' => 'Disable site caches.',
+    'arguments' => array(
+      'type' => 'Name of cache to disable.  Omit this argument to chosse from available caches.'
+    ),
+    'examples' => array(
+      'drush cache-disable css',
+    ),
+    'aliases' => array('cd'),
+  );
+  $items['cache-enable'] = array(

Could this be one command rather than two? The drush command listing is getting rather large. Something like the following? That would also save you the wrapper functions.

drush cache js 1
+++ b/commands/core/cache.drush.incundefined
@@ -42,6 +42,29 @@ function cache_drush_command() {
+    'arguments' => array(
+      'type' => 'Name of Cache to enable.  Omit this argument to choose from available caches.'
+    ),
+    'examples' => array(
+      'drush cache-enable css',
+    ),
+    'options' => array(

Might be good to liste the types of caches available to enable/disable (page, block, css, js, etc).

doublejosh’s picture

Any thoughts about a: cache-disable -aggressive, which would disable all possible cache variables?

$conf['cache'] = FALSE; //page cache
$conf['block_cache'] = FALSE; //block cache
$conf['preprocess_css'] = FALSE; //optimize css
$conf['preprocess_js'] = FALSE; //optimize javascript
$conf['advagg_enabled'] = FALSE; // advagg module
$conf['views_skip_cache'] = TRUE; // views cache
greg.1.anderson’s picture

Version: » 8.x-6.x-dev
Status: Needs work » Closed (won't fix)
Issue tags: +Needs migration

This issue was marked closed (won't fix) because Drush has moved to Github.

If this feature is still desired, you may copy it to our Github project. For best results, create a Pull Request that has been updated for the master branch. Post a link here to the PR, and please also change the status of this issue to closed (duplicate).

Please ask support questions on Drupal Answers.

Konstantin Komelin’s picture

Issue summary: View changes

For other folks who might be wondering like I was...

drush vset cache 0

Then choose 1.

Now we may use:
drush vset --exact cache 0