4 * Engine for the cache commands.
7 function _drush_cache_command_get($cid, $bin) {
9 $bin = _drush_cache_bin_default();
11 return cache_get($cid, $bin);
19 function _drush_cache_bin_default() {
23 function _drush_cache_command_set($cid, $data, $bin, $expire, $tags) {
24 // Convert the "expire" argument to a valid value for Drupal's cache_set().
26 $bin = _drush_cache_bin_default();
28 if ($expire == 'CACHE_TEMPORARY') {
29 $expire = CACHE_TEMPORARY;
31 if (!isset($expire) || $expire == 'CACHE_PERMANENT') {
32 $expire = CACHE_PERMANENT;
35 // D6/D7 don't natively support cache tags.
36 return cache_set($cid, $data, $bin, $expire);
39 function _drush_cache_clear_types($include_bootstrapped_types) {
41 'drush' => 'drush_cache_clear_drush',
42 'all' => 'drush_cache_clear_both',
44 if ($include_bootstrapped_types) {
46 'theme-registry' => 'drush_cache_clear_theme_registry',
47 'menu' => 'menu_rebuild',
48 'css-js' => 'drush_cache_clear_css_js',
49 'block' => 'drush_cache_clear_block',
50 'module-list' => 'drush_get_modules',
51 'theme-list' => 'drush_get_themes',
54 $drupal_version = drush_drupal_major_version();
56 if ($drupal_version >= 7) {
57 $types['registry'] = 'registry_update';
59 elseif ($drupal_version == 6 && function_exists('module_exists') && module_exists('autoload')) {
60 // TODO: move this to autoload module.
61 $types['registry'] = 'autoload_registry_update';
67 function drush_cache_clear_theme_registry() {
68 if (drush_drupal_major_version() >= 7) {
69 drupal_theme_rebuild();
72 cache_clear_all('theme_registry', 'cache', TRUE);
76 function drush_cache_clear_menu() {
77 return menu_router_rebuild();
80 function drush_cache_clear_css_js() {
81 _drupal_flush_css_js();
82 drupal_clear_css_cache();
83 drupal_clear_js_cache();
87 * Clear the cache of the block output.
89 function drush_cache_clear_block() {
90 cache_clear_all(NULL, 'cache_block');
94 * Clear caches internal to Drush core and Drupal.
96 function drush_cache_clear_both() {
97 drush_cache_clear_drush();
98 if (drush_has_boostrapped(DRUSH_BOOTSTRAP_DRUPAL_FULL)) {
99 drupal_flush_all_caches();