Merge pull request #863 from romainneutron/purge

[3.9] Reduce memory usage
This commit is contained in:
Nicolas Le Goff
2013-12-26 08:06:42 -08:00
13 changed files with 58 additions and 14 deletions

View File

@@ -49,7 +49,7 @@ class ACLProvider
/**
* Purges ACL cache
*/
public function purge()
public static function purge()
{
self::$cache = [];
}

View File

@@ -47,12 +47,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
*/
protected $_prefs = [];
/**
*
* @var array
*/
protected static $_users = [];
/**
*
* @var array
@@ -1352,4 +1346,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
return $vars;
}
public static function purge()
{
self::$_instance = [];
}
}

View File

@@ -27,12 +27,6 @@ class appbox extends base
*/
protected $id;
/**
*
* @var appbox
*/
protected static $_instance;
/**
*
* constant defining the app type

View File

@@ -465,4 +465,9 @@ class caption_Field_Value implements cache_cacheableInterface
unset(self::$localCache[$this->get_cache_key($option)]);
}
public static function purge()
{
self::$localCache = [];
}
}

View File

@@ -448,4 +448,9 @@ class caption_field implements cache_cacheableInterface
{
unset(self::$localCache[$this->get_cache_key($option)]);
}
public static function purge()
{
self::$localCache = [];
}
}

View File

@@ -730,4 +730,9 @@ class collection implements cache_cacheableInterface
{
return $this->databox->delete_data_from_cache($this->get_cache_key($option));
}
public static function purge()
{
self::$_collections = [];
}
}

View File

@@ -53,7 +53,7 @@ class connection
*/
public static function printLog(Application $app)
{
if (!$app['debug']) {
if ($app->getEnvironment() !== Application::ENV_DEV) {
return;
}

View File

@@ -1464,4 +1464,9 @@ class databox extends base
}
parent::delete_data_from_cache($option);
}
public static function purge()
{
self::$_xpath_thesaurus = self::$_dom_thesaurus = self::$_thesaurus = self::$_sxml_thesaurus = [];
}
}

View File

@@ -1071,4 +1071,9 @@ class databox_field implements cache_cacheableInterface
}
}
public static function purge()
{
self::$_instance = [];
}
}

View File

@@ -587,4 +587,9 @@ class databox_status
return $status;
}
public static function purge()
{
self::$_status = self::$_statuses = [];
}
}

View File

@@ -236,4 +236,9 @@ class patch_320alpha4b implements patchInterface
return $feed;
}
public static function purge()
{
self::$feeds = [];
}
}

View File

@@ -35,4 +35,9 @@ class thesaurus_xpath extends DOMXPath
return(self::$r[$context_path]);
}
public static function purge()
{
self::$r = [];
}
}

View File

@@ -220,6 +220,7 @@ abstract class PhraseanetTestCase extends WebTestCase
public static function tearDownAfterClass()
{
self::$testCaseBooted = false;
gc_collect_cycles();
parent::tearDownAfterClass();
}
@@ -298,6 +299,16 @@ abstract class PhraseanetTestCase extends WebTestCase
public function tearDown()
{
\Alchemy\Phrasea\Authentication\ACLProvider::purge();
\collection::purge();
\databox::purge();
\caption_field::purge();
\caption_Field_Value::purge();
\databox_field::purge();
\databox_status::purge();
\thesaurus_xpath::purge();
\User_Adapter::purge();
/**
* Kris Wallsmith pro-tip
* @see http://kriswallsmith.net/post/18029585104/faster-phpunit