Restore cache clearing functionality

This commit is contained in:
Timothy Warren 2017-01-16 11:26:19 -05:00
parent d79370deb9
commit a266c68f9b
5 changed files with 21 additions and 11 deletions

View File

@ -17,13 +17,13 @@
[<a href="<?= $urlGenerator->default_url('manga') ?>">Manga List</a>]
<?php endif ?>
</span>
<?php /* if ($auth->is_authenticated()): ?>
<?php if ($auth->is_authenticated()): ?>
<span class="flex-no-wrap">&nbsp;</span>
<span class="flex-no-wrap small-font">
<button type="button" class="js-clear-cache user-btn">Clear API Cache</button>
</span>
<span class="flex-no-wrap">&nbsp;</span>
<?php endif */ ?>
<?php endif ?>
<span class="flex-no-wrap small-font">
<?php if ($auth->is_authenticated()): ?>
<a class="bracketed" href="<?= $url->generate('logout') ?>">Logout</a>

View File

@ -41,6 +41,16 @@ trait CacheTrait {
return $this;
}
/**
* Get the cache object if it exists
*
* @return Pool
*/
public function getCache()
{
return $this->cache;
}
/**
* Generate a hash as a cache key from the current method call
*

View File

@ -374,7 +374,7 @@ class Controller {
*/
public function clearCache()
{
$this->cache->purge();
$this->cache->clear();
$this->outputHTML('blank', [
'title' => 'Cache cleared'
], NULL, 200);

View File

@ -159,7 +159,7 @@ class Anime extends BaseController {
if ($result)
{
$this->set_flash_message('Added new anime to list', 'success');
// $this->cache->purge();
$this->cache->clear();
}
else
{
@ -233,7 +233,7 @@ class Anime extends BaseController {
if ($full_result['statusCode'] === 200)
{
$this->set_flash_message("Successfully updated.", 'success');
// $this->cache->purge();
$this->cache->clear();
}
else
{
@ -261,7 +261,7 @@ class Anime extends BaseController {
$response = $this->model->updateLibraryItem($data);
// $this->cache->purge();
$this->cache->clear();
$this->outputJSON($response['body'], $response['statusCode']);
}
@ -278,7 +278,7 @@ class Anime extends BaseController {
if ((bool)$response === TRUE)
{
$this->set_flash_message("Successfully deleted anime.", 'success');
// $this->cache->purge();
$this->cache->clear();
}
else
{

View File

@ -142,7 +142,7 @@ class Manga extends Controller {
if ($result)
{
$this->set_flash_message('Added new manga to list', 'success');
// $this->cache->purge();
$this->cache->clear();
}
else
{
@ -203,7 +203,7 @@ class Manga extends Controller {
if ($full_result['statusCode'] === 200)
{
$this->set_flash_message("Successfully updated manga.", 'success');
// $this->cache->purge();
$this->cache->clear();
}
else
{
@ -232,7 +232,7 @@ class Manga extends Controller {
$response = $this->model->updateLibraryItem($data);
// $this->cache->purge();
$this->cache->clear();
$this->outputJSON($response['body'], $response['statusCode']);
}
@ -250,7 +250,7 @@ class Manga extends Controller {
if ($response)
{
$this->set_flash_message("Successfully deleted manga.", 'success');
//$this->cache->purge();
$this->cache->clear();
}
else
{