Skip to content

Commit e2b36c8

Browse files
committed
[plugin:aws,isbn] cache control with "root->rtf['use_cache_always']"
検索時などで、検索対象になったページの内容取得時に、できるだけページキャッシュを利用するようになっているのですが、 ページキャッシュがなく、Amazon のデータもキャッシュ期限が切れていると、それらのページの amazon データを取得していました。 結果、検索結果の表示までにかなり時間が掛かることがあるので、検索時の本文取得は、キャッシュがある限り期限切れでもそれを利用するようにしました。
1 parent 3c3c548 commit e2b36c8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

xoops_trust_path/modules/xpwiki/plugin/aws.inc.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ function plugin_aws_get($f, $m, $k, $b, $s) {
146146
@ unlink($cache_file);
147147
}
148148

149-
if (is_readable($cache_file) && filemtime($cache_file) + $this->config['cache_time'] * 60 > $this->cont['UTC']) {
149+
if (is_readable($cache_file) && (!empty($this->root->rtf['use_cache_always']) || filemtime($cache_file) + $this->config['cache_time'] * 60 > $this->cont['UTC'])) {
150150
$ret = file_get_contents($cache_file);
151151
} else {
152152
include_once $this->cont['TRUST_PATH'] . 'class/hyp_common/hsamazon/hyp_simple_amazon.php';

xoops_trust_path/modules/xpwiki/plugin/isbn.inc.php

+4
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,10 @@ function plugin_isbn_cache_fetch($target, $dir, $check = true) {
338338
$filename = $dir . $target . '_' . $this->config['AMAZON_ASE_ID'] . '.isbn';
339339

340340
$error = '';
341+
342+
if (! empty($this->root->rtf['use_cache_always'])) {
343+
$check = false;
344+
}
341345

342346
if (!is_file($filename) ||
343347
($check && $this->config['ISBN_AMAZON_EXPIRE_TIT'] * 3600 * 24 < $this->cont['UTC'] - filemtime($filename))) {

0 commit comments

Comments
 (0)