diff --git a/drush b/drush
index 5bcd294..c17ddb4 100755
--- a/drush
+++ b/drush
@@ -41,6 +41,9 @@ if [ -z $COLUMNS ] && [ -n "$TERM" ] && [ "$TERM" != dumb ] ; then
   fi
 fi
 
+export APCCACHE='/dev/shm/drush.apc'
+#export APCCACHE='/home/vagrant/bin/drushdir/drush.apc'
+
 if [ ! -z "$DRUSH_PHP" ] ; then
   # Use the DRUSH_PHP environment variable if it is available.
   php="$DRUSH_PHP"
diff --git a/drush.php b/drush.php
index 7a427af..4282d04 100755
--- a/drush.php
+++ b/drush.php
@@ -20,9 +20,18 @@ if (version_compare(phpversion(), DRUSH_MINIMUM_PHP) < 0) {
 
 define('DRUSH_BASE_PATH', dirname(__FILE__));
 
-
 define('DRUSH_REQUEST_TIME', microtime(TRUE));
 
+// Load the stored APC opcode cache, if available.
+define('DRUSH_APC_CACHE', getenv('APCCACHE'));
+if (strlen(DRUSH_APC_CACHE) > 0 && function_exists('apc_bin_loadfile') && is_readable(DRUSH_APC_CACHE)) {
+  // print_r(apc_cache_info());
+  // $str = (binary) file_get_contents(DRUSH_APC_CACHE);
+  //apc_bin_load($str, APC_BIN_VERIFY_CRC32 | APC_BIN_VERIFY_MD5);
+  apc_bin_loadfile(DRUSH_APC_CACHE, NULL, APC_BIN_VERIFY_CRC32 | APC_BIN_VERIFY_MD5);
+  //print_r(apc_cache_info());
+}
+
 require_once DRUSH_BASE_PATH . '/includes/environment.inc';
 require_once DRUSH_BASE_PATH . '/includes/command.inc';
 require_once DRUSH_BASE_PATH . '/includes/drush.inc';
@@ -145,6 +154,24 @@ function drush_main() {
     }
   }
 
+  $apccache = strlen(DRUSH_APC_CACHE) > 0 ? DRUSH_APC_CACHE : FALSE;
+  // Store the APC opcode cache.
+  if (!empty($apccache) && function_exists('apc_bin_dumpfile') && (is_writable($apccache) || is_writable(dirname($apccache)))) {
+    // var_dump(apc_cache_info());
+    $apcinfo = new APCIterator('file', NULL, APC_ITER_FILENAME);
+    $files = array();
+    foreach ($apcinfo as $val) {
+      $files[] = $val['filename'];
+    }
+    // $files = array_slice($files, 8, 1, TRUE);
+    // unset($files[20], $files[9]);
+    // print_r($files);
+    // apc_bin_dumpfile($files, NULL, DRUSH_APC_CACHE);
+    apc_bin_dumpfile($files, array(), DRUSH_APC_CACHE);
+    // $out = (binary) apc_bin_dump($files, array());
+    // file_put_contents(DRUSH_APC_CACHE, $out);
+  }
+
   // We set this context to let the shutdown function know we reached the end of drush_main();
   drush_set_context("DRUSH_EXECUTION_COMPLETED", TRUE);
 