diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php
index 9fef53fa95a0c8956e44dd9a74f36e6345f9afc2..ed85d3c07ccb5e7f0cbe031c2a5ce1cbe6803caa 100644
--- a/lib/private/files/storage/common.php
+++ b/lib/private/files/storage/common.php
@@ -56,6 +56,9 @@ use OCP\Files\ReservedWordException;
  * in classes which extend it, e.g. $this->stat() .
  */
 abstract class Common implements Storage {
+
+	use LocalTempFileTrait;
+
 	protected $cache;
 	protected $scanner;
 	protected $watcher;
@@ -63,11 +66,6 @@ abstract class Common implements Storage {
 
 	protected $mountOptions = [];
 
-	/**
-	 * @var string[]
-	 */
-	protected $cachedFiles = array();
-
 	public function __construct($parameters) {
 	}
 
@@ -247,27 +245,6 @@ abstract class Common implements Storage {
 		return $this->getCachedFile($path);
 	}
 
-	/**
-	 * @param string $path
-	 * @return string
-	 */
-	protected function toTmpFile($path) { //no longer in the storage api, still useful here
-		$source = $this->fopen($path, 'r');
-		if (!$source) {
-			return false;
-		}
-		if ($pos = strrpos($path, '.')) {
-			$extension = substr($path, $pos);
-		} else {
-			$extension = '';
-		}
-		$tmpFile = \OC_Helper::tmpFile($extension);
-		$target = fopen($tmpFile, 'w');
-		\OC_Helper::streamCopy($source, $target);
-		fclose($target);
-		return $tmpFile;
-	}
-
 	public function getLocalFolder($path) {
 		$baseDir = \OC_Helper::tmpFolder();
 		$this->addLocalFolder($path, $baseDir);
@@ -450,20 +427,6 @@ abstract class Common implements Storage {
 		return false;
 	}
 
-	/**
-	 * @param string $path
-	 */
-	protected function getCachedFile($path) {
-		if (!isset($this->cachedFiles[$path])) {
-			$this->cachedFiles[$path] = $this->toTmpFile($path);
-		}
-		return $this->cachedFiles[$path];
-	}
-
-	protected function removeCachedFile($path) {
-		unset($this->cachedFiles[$path]);
-	}
-
 	/**
 	 * Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class
 	 *
diff --git a/lib/private/files/storage/localtempfiletrait.php b/lib/private/files/storage/localtempfiletrait.php
new file mode 100644
index 0000000000000000000000000000000000000000..444e4e2e89e8b3927ebe09e0da8fb7340c7c9211
--- /dev/null
+++ b/lib/private/files/storage/localtempfiletrait.php
@@ -0,0 +1,85 @@
+<?php
+/**
+ * @author Thomas Müller <thomas.mueller@tmit.eu>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OC\Files\Storage;
+
+use OC\Files\Cache\Cache;
+use OC\Files\Cache\Scanner;
+use OC\Files\Filesystem;
+use OC\Files\Cache\Watcher;
+use OCP\Files\FileNameTooLongException;
+use OCP\Files\InvalidCharacterInPathException;
+use OCP\Files\InvalidPathException;
+use OCP\Files\ReservedWordException;
+
+/**
+ * Storage backend class for providing common filesystem operation methods
+ * which are not storage-backend specific.
+ *
+ * \OC\Files\Storage\Common is never used directly; it is extended by all other
+ * storage backends, where its methods may be overridden, and additional
+ * (backend-specific) methods are defined.
+ *
+ * Some \OC\Files\Storage\Common methods call functions which are first defined
+ * in classes which extend it, e.g. $this->stat() .
+ */
+trait LocalTempFileTrait {
+
+	/**
+	 * @var string[]
+	 */
+	protected $cachedFiles = array();
+
+	/**
+	 * @param string $path
+	 */
+	protected function getCachedFile($path) {
+		if (!isset($this->cachedFiles[$path])) {
+			$this->cachedFiles[$path] = $this->toTmpFile($path);
+		}
+		return $this->cachedFiles[$path];
+	}
+
+	protected function removeCachedFile($path) {
+		unset($this->cachedFiles[$path]);
+	}
+
+	/**
+	 * @param string $path
+	 * @return string
+	 */
+	protected function toTmpFile($path) { //no longer in the storage api, still useful here
+		$source = $this->fopen($path, 'r');
+		if (!$source) {
+			return false;
+		}
+		if ($pos = strrpos($path, '.')) {
+			$extension = substr($path, $pos);
+		} else {
+			$extension = '';
+		}
+		$tmpFile = \OC_Helper::tmpFile($extension);
+		$target = fopen($tmpFile, 'w');
+		\OC_Helper::streamCopy($source, $target);
+		fclose($target);
+		return $tmpFile;
+	}
+}