diff --git a/lib/private/Cache/File.php b/lib/private/Cache/File.php
index f2992a614e43a152ec2f8e72432b72751aa4a851..38f88959bd75fe0cbe5391a3706e3ce6c5ecb489 100644
--- a/lib/private/Cache/File.php
+++ b/lib/private/Cache/File.php
@@ -111,7 +111,7 @@ class File implements ICache {
 		$keyPart = $key . '.' . $uniqueId . '.part';
 		if ($storage and $storage->file_put_contents($keyPart, $value)) {
 			if ($ttl === 0) {
-				$ttl = \OC::$server->getConfig()->getSystemValue('cache_folder_gc_ttl', 86400);
+				$ttl = 86400; // 60*60*24
 			}
 			$result = $storage->touch($keyPart, time() + $ttl);
 			$result &= $storage->rename($keyPart, $key);
diff --git a/lib/private/legacy/filechunking.php b/lib/private/legacy/filechunking.php
index f2cef27545895ffabd28382a764f5389199db9d9..f58497a3c98a8ab1585b69ff9e16426834217992 100644
--- a/lib/private/legacy/filechunking.php
+++ b/lib/private/legacy/filechunking.php
@@ -31,6 +31,13 @@ class OC_FileChunking {
 	protected $info;
 	protected $cache;
 
+	/**
+	 * TTL of chunks
+	 *
+	 * @var int
+	 */
+	protected $ttl;
+
 	static public function decodeName($name) {
 		preg_match('/(?P<name>.*)-chunking-(?P<transferid>\d+)-(?P<chunkcount>\d+)-(?P<index>\d+)/', $name, $matches);
 		return $matches;
@@ -41,6 +48,7 @@ class OC_FileChunking {
 	 */
 	public function __construct($info) {
 		$this->info = $info;
+		$this->ttl = \OC::$server->getConfig()->getSystemValue('cache_folder_gc_ttl', 86400);
 	}
 
 	public function getPrefix() {
@@ -67,7 +75,7 @@ class OC_FileChunking {
 	public function store($index, $data) {
 		$cache = $this->getCache();
 		$name = $this->getPrefix().$index;
-		$cache->set($name, $data);
+		$cache->set($name, $data, $this->ttl);
 
 		return $cache->size($name);
 	}