Skip to content

Commit

Permalink
[plugin:aws,isbn] cache control with "root->rtf['use_cache_always']"
Browse files Browse the repository at this point in the history
検索時などで、検索対象になったページの内容取得時に、できるだけページキャッシュを利用するようになっているのですが、
ページキャッシュがなく、Amazon のデータもキャッシュ期限が切れていると、それらのページの amazon データを取得していました。
結果、検索結果の表示までにかなり時間が掛かることがあるので、検索時の本文取得は、キャッシュがある限り期限切れでもそれを利用するようにしました。
  • Loading branch information
nao-pon committed Sep 10, 2013
1 parent 3c3c548 commit e2b36c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion xoops_trust_path/modules/xpwiki/plugin/aws.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function plugin_aws_get($f, $m, $k, $b, $s) {
@ unlink($cache_file);
}

if (is_readable($cache_file) && filemtime($cache_file) + $this->config['cache_time'] * 60 > $this->cont['UTC']) {
if (is_readable($cache_file) && (!empty($this->root->rtf['use_cache_always']) || filemtime($cache_file) + $this->config['cache_time'] * 60 > $this->cont['UTC'])) {
$ret = file_get_contents($cache_file);
} else {
include_once $this->cont['TRUST_PATH'] . 'class/hyp_common/hsamazon/hyp_simple_amazon.php';
Expand Down
4 changes: 4 additions & 0 deletions xoops_trust_path/modules/xpwiki/plugin/isbn.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@ function plugin_isbn_cache_fetch($target, $dir, $check = true) {
$filename = $dir . $target . '_' . $this->config['AMAZON_ASE_ID'] . '.isbn';

$error = '';

if (! empty($this->root->rtf['use_cache_always'])) {
$check = false;
}

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

0 comments on commit e2b36c8

Please sign in to comment.