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

WIP: Refactored cache drivers 🗃 #703

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions admin/admin_log.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

require __DIR__ . '/pagestart.php';

$datastore->enqueue(array(
$datastore->enqueue([
'moderators',
'cat_forums',
));
]);

$log_action->init();

Expand Down
6 changes: 3 additions & 3 deletions common.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ function CACHE(string $cache_name)
case 'memcache':
$datastore = new TorrentPier\Legacy\Datastore\Memcache($bb_cfg['cache']['memcache'], $bb_cfg['cache']['prefix']);
break;

case 'sqlite':
$default_cfg = [
'db_file_path' => $bb_cfg['cache']['db_dir'] . 'datastore.sqlite.db',
Expand All @@ -158,11 +157,12 @@ function CACHE(string $cache_name)
];
$datastore = new TorrentPier\Legacy\Datastore\Sqlite($default_cfg, $bb_cfg['cache']['prefix']);
break;

case 'redis':
$datastore = new TorrentPier\Legacy\Datastore\Redis($bb_cfg['cache']['redis'], $bb_cfg['cache']['prefix']);
break;

case 'apcu':
$datastore = new TorrentPier\Legacy\Datastore\APCu($bb_cfg['cache']['prefix']);
break;
case 'filecache':
default:
$datastore = new TorrentPier\Legacy\Datastore\File($bb_cfg['cache']['db_dir'] . 'datastore/', $bb_cfg['cache']['prefix']);
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"jacklul/monolog-telegram": "^3.1",
"josantonius/cookie": "^2.0",
"longman/ip-tools": "1.2.1",
"matthiasmullie/scrapbook": "^1.5",
"monolog/monolog": "^3.4",
"samdark/sitemap": "2.4.1",
"symfony/mailer": "^6.3",
Expand Down
204 changes: 202 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
]);

if ($bb_cfg['show_latest_news']) {
$datastore->enqueue('latest_news');
$datastore->enqueue(['latest_news']);
}
if ($bb_cfg['show_network_news']) {
$datastore->enqueue('network_news');
$datastore->enqueue(['network_news']);
}

// Init userdata
Expand Down
4 changes: 2 additions & 2 deletions library/ajax/mod_action.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@
// Обновление кеша новостей на главной
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
if (isset($news_forums[$t_data['forum_id']]) && $bb_cfg['show_latest_news']) {
$datastore->enqueue('latest_news');
$datastore->enqueue(['latest_news']);
$datastore->update('latest_news');
}

$net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id']));
if (isset($net_forums[$t_data['forum_id']]) && $bb_cfg['show_network_news']) {
$datastore->enqueue('network_news');
$datastore->enqueue(['network_news']);
$datastore->update('network_news');
}

Expand Down
8 changes: 4 additions & 4 deletions modcp.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,13 @@ function validate_mode_condition($request_index, $mod_action = '')
//Обновление кеша новостей на главной
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
if (isset($news_forums[$forum_id]) && $bb_cfg['show_latest_news'] && $result) {
$datastore->enqueue('latest_news');
$datastore->enqueue(['latest_news']);
$datastore->update('latest_news');
}

$net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id']));
if (isset($net_forums[$forum_id]) && $bb_cfg['show_network_news'] && $result) {
$datastore->enqueue('network_news');
$datastore->enqueue(['network_news']);
$datastore->update('network_news');
}

Expand All @@ -256,13 +256,13 @@ function validate_mode_condition($request_index, $mod_action = '')
//Обновление кеша новостей на главной
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
if ((isset($news_forums[$forum_id]) || isset($news_forums[$new_forum_id])) && $bb_cfg['show_latest_news'] && $result) {
$datastore->enqueue('latest_news');
$datastore->enqueue(['latest_news']);
$datastore->update('latest_news');
}

$net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id']));
if ((isset($net_forums[$forum_id]) || isset($net_forums[$new_forum_id])) && $bb_cfg['show_network_news'] && $result) {
$datastore->enqueue('network_news');
$datastore->enqueue(['network_news']);
$datastore->update('network_news');
}

Expand Down
Loading
Loading