Cache system ; use a different cache file per user... will see how to improve it
This commit is contained in:
parent
e4fd74e6ee
commit
6e774619c1
5
TODO
5
TODO
@ -4,7 +4,10 @@ inc/Invoices.class.php :
|
|||||||
========================
|
========================
|
||||||
* Modify store() method to handle storage
|
* Modify store() method to handle storage
|
||||||
* Modify load() method to handle complex queries (such as WHERE date < DATE_1 AND date > DATE_2)
|
* Modify load() method to handle complex queries (such as WHERE date < DATE_1 AND date > DATE_2)
|
||||||
* Cache
|
|
||||||
|
==========
|
||||||
|
* Don't cache the username
|
||||||
|
==========
|
||||||
|
|
||||||
Manage paybacks :
|
Manage paybacks :
|
||||||
=================
|
=================
|
||||||
|
24
index.php
24
index.php
@ -161,6 +161,10 @@
|
|||||||
|
|
||||||
if(!empty($_POST['user_id']) || $user->isUnique()) {
|
if(!empty($_POST['user_id']) || $user->isUnique()) {
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
|
// Clear the cache
|
||||||
|
array_map("unlink", glob(raintpl::$cache_dir."*.rtpl.php"));
|
||||||
|
|
||||||
header('location: index.php?do=edit_users');
|
header('location: index.php?do=edit_users');
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
@ -203,6 +207,9 @@
|
|||||||
$user->setId($_GET['user_id']);
|
$user->setId($_GET['user_id']);
|
||||||
$user->delete();
|
$user->delete();
|
||||||
|
|
||||||
|
// Clear the cache
|
||||||
|
array_map("unlink", glob(raintpl::$cache_dir."*.rtpl.php"));
|
||||||
|
|
||||||
header('location: index.php?do=edit_users');
|
header('location: index.php?do=edit_users');
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
@ -212,6 +219,9 @@
|
|||||||
if(isset($_POST['notice'])) {
|
if(isset($_POST['notice'])) {
|
||||||
setNotice($_POST['notice']);
|
setNotice($_POST['notice']);
|
||||||
|
|
||||||
|
// Clear the cache
|
||||||
|
array_map("unlink", glob(raintpl::$cache_dir."*.rtpl.php"));
|
||||||
|
|
||||||
header('location: index.php');
|
header('location: index.php');
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
@ -252,6 +262,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(file_put_contents("data/config.php", $config)) {
|
if(file_put_contents("data/config.php", $config)) {
|
||||||
|
// Clear the cache
|
||||||
|
array_map("unlink", glob(raintpl::$cache_dir."*.rtpl.php"));
|
||||||
|
|
||||||
header('location: index.php');
|
header('location: index.php');
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
@ -323,6 +336,10 @@
|
|||||||
$invoice->setGuests($guests);
|
$invoice->setGuests($guests);
|
||||||
|
|
||||||
$invoice->save();
|
$invoice->save();
|
||||||
|
|
||||||
|
// Clear the cache
|
||||||
|
array_map("unlink", glob(raintpl::$cache_dir."*.rtpl.php"));
|
||||||
|
|
||||||
header('location: index.php');
|
header('location: index.php');
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
@ -359,6 +376,9 @@
|
|||||||
$invoice->setId($_GET['id']);
|
$invoice->setId($_GET['id']);
|
||||||
$invoice->delete();
|
$invoice->delete();
|
||||||
|
|
||||||
|
// Clear the cache
|
||||||
|
array_map("unlink", glob(raintpl::$cache_dir."*.rtpl.php"));
|
||||||
|
|
||||||
header('location: index.php');
|
header('location: index.php');
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
@ -366,7 +386,7 @@
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
// Display cached page in priority
|
// Display cached page in priority
|
||||||
if($cache = $tpl->cache('index', $expire_time = 600, $cache_id = NULL)) {
|
if($cache = $tpl->cache('index', $expire_time = 600, $cache_id = $current_user->getLogin())) {
|
||||||
echo $cache;
|
echo $cache;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -380,7 +400,7 @@
|
|||||||
$tpl->assign('invoices', secureDisplay($invoices_list));
|
$tpl->assign('invoices', secureDisplay($invoices_list));
|
||||||
|
|
||||||
// Cache the page (1 month to make it almost permanent and only regenerate it upon new invoice)
|
// Cache the page (1 month to make it almost permanent and only regenerate it upon new invoice)
|
||||||
$tpl->cache('index', 108000, NULL);
|
$tpl->cache('index', 108000, $current_user->getLogin());
|
||||||
|
|
||||||
$tpl->draw('index');
|
$tpl->draw('index');
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user