Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make chunk cache ttl configurable #24812

Merged
merged 3 commits into from
May 25, 2016
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,14 @@
*/
'cache_path' => '',

/**
* TTL of files located in the cache folder before they're removed by
* garbage collection (in seconds). Increase this value if users have
* issues uploading very large files via the ownCloud Client as upload isn't
* completed within one day.
*/
'cache_folder_gc_ttl' => 86400, // 60*60*24 = 1 day
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should probably rename the value to "chunk_ttl" since the value now only applies to chunks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, pushed


/**
* Using Object Store with ownCloud
*/
Expand Down
10 changes: 9 additions & 1 deletion lib/private/legacy/filechunking.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -41,6 +48,7 @@ static public function decodeName($name) {
*/
public function __construct($info) {
$this->info = $info;
$this->ttl = \OC::$server->getConfig()->getSystemValue('cache_folder_gc_ttl', 86400);
}

public function getPrefix() {
Expand All @@ -67,7 +75,7 @@ protected function getCache() {
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);
}
Expand Down