From f0dd547bd84b4461cdab8d7d556bdb275bf4864a Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Mon, 10 Aug 2015 00:16:55 +0200 Subject: 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 --- application/controllers/file.php | 3 ++- application/models/mfile.php | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'application') 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) -- cgit v1.2.3-24-g4f1b