diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-05-24 14:58:27 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-05-24 14:58:27 +0200 |
commit | c9b26d065b567fa3a62a5ecfcfebb8fb275e9f1c (patch) | |
tree | f8caff0c0e8ac33a3da44381d0d343543e5bf9c0 /lib | |
parent | 299520b32249881a2e459f9812c55dfc79f6d746 (diff) | |
download | nextcloud-server-c9b26d065b567fa3a62a5ecfcfebb8fb275e9f1c.tar.gz nextcloud-server-c9b26d065b567fa3a62a5ecfcfebb8fb275e9f1c.zip |
Move cache chunk TTL value to FileChunking class
This makes it less generic and only used for actual file chunking
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Cache/File.php | 2 | ||||
-rw-r--r-- | lib/private/legacy/filechunking.php | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/private/Cache/File.php b/lib/private/Cache/File.php index f2992a614e4..38f88959bd7 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 f2cef275458..f58497a3c98 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); } |