summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2015-08-10 00:16:55 +0200
committerFlorian Pritz <bluewind@xinu.at>2015-08-10 00:16:55 +0200
commitf0dd547bd84b4461cdab8d7d556bdb275bf4864a (patch)
tree3e334f1c812488af3b4d4ddc638b1b29c19c3972 /application
parentdeb442de494680114fcbafa824689b00b5e2b2e0 (diff)
Increase thumbnail cache ttl
Also try to clean up when files are deleted since 1 month is a rather long time. Granted, thumbnails are small, but whatever Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application')
-rw-r--r--application/controllers/file.php3
-rw-r--r--application/models/mfile.php1
2 files changed, 3 insertions, 1 deletions
diff --git a/application/controllers/file.php b/application/controllers/file.php
index 85cef5490..868366af0 100644
--- a/application/controllers/file.php
+++ b/application/controllers/file.php
@@ -641,6 +641,7 @@ class File extends MY_Controller {
handle_etag($etag);
$thumb_size = 150;
+ $cache_timeout = 60*60*24*30; # 1 month
$filedata = $this->mfile->get_filedata($id);
if (!$filedata) {
@@ -649,7 +650,7 @@ class File extends MY_Controller {
$cache_key = $filedata['data_id'].'_thumb_'.$thumb_size;
- $thumb = cache_function($cache_key, 100, function() use ($filedata, $thumb_size){
+ $thumb = cache_function($cache_key, $cache_timeout, function() use ($filedata, $thumb_size){
$CI =& get_instance();
$img = new libraries\Image($this->mfile->file($filedata["data_id"]));
$img->makeThumb($thumb_size, $thumb_size);
diff --git a/application/models/mfile.php b/application/models/mfile.php
index 5139a2eee..ea81ee32d 100644
--- a/application/models/mfile.php
+++ b/application/models/mfile.php
@@ -251,6 +251,7 @@ class Mfile extends CI_Model {
rmdir($dir);
}
}
+ delete_cache("${data_id}_thumb_150");
}
public function get_owner($id)