? ? Failure

User tests: Successful: Unsuccessful:

avatar mbabker
mbabker
2 Sep 2016

Summary of Changes

#11565 added support for flushing the full cache and is only implemented for Memcache(d) right now. Implement it for more of the adapters.

Testing Instructions

Calling the flush() method of the cache storage adapter causes the cache store to be flushed. JFactory::getCache()->flush().

Documentation Changes Required

N/A

avatar mbabker mbabker - open - 2 Sep 2016
avatar mbabker mbabker - change - 2 Sep 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 2 Sep 2016
Category Libraries
avatar joomla-cms-bot joomla-cms-bot - change - 2 Sep 2016
Labels Added: ?
avatar andrepereiradasilva
andrepereiradasilva - comment - 2 Sep 2016

shouldn't we have unit tests for this? or for another PR?

avatar alikon
alikon - comment - 3 Sep 2016

i've tested with redis using JFactory::getCache()->_getStorage()->flush();

since FLUSHDB

Delete all the keys of the currently selected DB

should be used very carefully

avatar alikon alikon - test_item - 3 Sep 2016 - Tested successfully
avatar alikon
alikon - comment - 3 Sep 2016

I have tested this item successfully on a1b785b

with redis


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11898.

avatar andrepereiradasilva
andrepereiradasilva - comment - 3 Sep 2016

Hum so could this have a side effect and flush sessions too?

avatar mbabker
mbabker - comment - 3 Sep 2016

Hum so could this have a side effect and flush sessions too?

They all could and probably will have side effects honestly. Unless we force our code to use different servers for cache and session or write the methods to loop through the entire cache store and only remove stuff explicitly added by the cache handler, it's going to delete everything as instructed by each handler's flush API (the only one without side effects is the filesystem handler unless you've got your sessions configured to use the cache directory, in which case, I'm only going to sit back and laugh when you come up with a bug report about that scenario).

avatar joomla-cms-bot joomla-cms-bot - change - 3 Sep 2016
Category Libraries Libraries Unit Tests
avatar joomla-cms-bot joomla-cms-bot - change - 3 Sep 2016
Labels Added: ?
avatar mbabker
mbabker - comment - 3 Sep 2016

shouldn't we have unit tests for this?

Done.

avatar andrepereiradasilva
andrepereiradasilva - comment - 6 Sep 2016

(the only one without side effects is the filesystem handler unless you've got your sessions configured to use the cache directory, in which case, I'm only going to sit back and laugh when you come up with a bug report about that scenario).

ehehehhe

avatar csthomas csthomas - test_item - 9 Sep 2016 - Tested successfully
avatar csthomas
csthomas - comment - 9 Sep 2016

I have tested this item successfully on 25d6335

I have prepared console.php file to include joomla dependencies.

$ php -a -dauto_prepend_file=console.php
Interactive mode enabled

php > $cache = JFactory::getCache('', 'output');
php > print_r($cache->options);
Array
(
    [cachebase] => [...]/demo/cache
    [lifetime] => 5
    [language] => en-GB
    [storage] => file
    [defaultgroup] => 
    [locking] => 1
    [locktime] => 15
    [checkTime] => 1
    [caching] => 1
)
php > var_dump($cache->_getStorage()->getAll());
array(0) {
}
php > var_dump($cache->store('some data', 'id', 'group'));
bool(true)
php > var_dump($cache->store('some data2', 'id2', 'group2'));
bool(true)
php > var_dump($cache->_getStorage()->getAll());
array(2) {
  ["group2"]=>
  object(JCacheStorageHelper)#23 (3) {
    ["group"]=>
    string(6) "group2"
    ["size"]=>
    string(4) "0.08"
    ["count"]=>
    int(2)
  }
  ["group"]=>
  object(JCacheStorageHelper)#24 (3) {
    ["group"]=>
    string(5) "group"
    ["size"]=>
    string(4) "0.08"
    ["count"]=>
    int(2)
  }
}
php > var_dump($cache->_getStorage()->flush());
bool(true)
php > var_dump($cache->_getStorage()->getAll());
array(0) {
}

## ADDITIONAL TEST

php > var_dump($cache->_getStorage()->get('id', 'group'));
bool(false)
php > var_dump($cache->_getStorage()->getAll());
array(1) {
  ["group"]=>
  object(JCacheStorageHelper)#21 (3) {
    ["group"]=>
    string(5) "group"
    ["size"]=>
    string(4) "0.03"
    ["count"]=>
    int(1)
  }
}
php > var_dump($cache->_getStorage()->flush());
bool(true)
php > var_dump($cache->_getStorage()->getAll());
array(0) {
}

## TEST APCU

php > $cache->options['storage'] = 'apcu';
php > var_dump($cache->_getStorage()->getAll());
array(0) {
}
php > var_dump($cache->store('some data', 'id', 'group'));   
bool(true)
php > var_dump($cache->store('some data2', 'id2', 'group2'));
bool(true)
php > var_dump($cache->_getStorage()->getAll());
array(2) {
  ["group2"]=>
  object(JCacheStorageHelper)#22 (3) {
    ["group"]=>
    string(6) "group2"
    ["size"]=>
    string(4) "0.64"
    ["count"]=>
    int(1)
  }
  ["group"]=>
  object(JCacheStorageHelper)#23 (3) {
    ["group"]=>
    string(5) "group"
    ["size"]=>
    string(4) "0.64"
    ["count"]=>
    int(1)
  }
}
php > var_dump($cache->_getStorage()->flush());
bool(true)
php > var_dump($cache->_getStorage()->getAll());
array(0) {
}
avatar mbabker mbabker - change - 2 Jan 2017
The description was changed
avatar mbabker mbabker - change - 2 Jan 2017
The description was changed
avatar mbabker mbabker - edited - 2 Jan 2017
avatar mbabker
mbabker - comment - 7 Jan 2017

... well?

avatar csthomas
csthomas - comment - 30 Jan 2017

I have tested this item successfully on 58f61f5


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/11898.

avatar csthomas csthomas - test_item - 30 Jan 2017 - Tested successfully
avatar mbabker mbabker - change - 30 May 2017
Labels Added: ?
Removed: ?
avatar brianteeman
brianteeman - comment - 20 Aug 2017

Any reason this cant be merged? Looks like we have two tests from @alikon and @csthomas

avatar mbabker mbabker - change - 20 Aug 2017
Labels Added: ?
Removed: ?
avatar mbabker
mbabker - comment - 20 Aug 2017

Well, if someone wants to do one more test/review and then anyone but me hit merge then it's fine.

avatar mbabker
mbabker - comment - 12 Nov 2017

No interest, fine.

avatar mbabker mbabker - change - 12 Nov 2017
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2017-11-12 16:00:43
Closed_By mbabker
avatar mbabker mbabker - close - 12 Nov 2017
avatar tonypartridge
tonypartridge - comment - 27 Nov 2017

can you reopen I’ll test, sorry didn’t see this.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 28 Nov 2017

can't reopen, get "422 RuntimeException". Guess the PR is deleted.

Add a Comment

Login with GitHub to post a comment