summaryrefslogtreecommitdiff
path: root/framework/Collections
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2016-02-25 17:01:17 +0100
committerFabio Bas <ctrlaltca@gmail.com>2016-02-25 17:01:17 +0100
commit562e322fe595b4d3307ff28a96c8c5fbcc284010 (patch)
tree4b16f146c8ee931dc084758798cfdb32f64b914b /framework/Collections
parent294682fb45014ba04ce1b193af712208b15a6151 (diff)
Applied some misc optimizations to class serialization
Avoid saving in the page state the values of class variables if they’re still the default. Reduces page state size, based on the work initiated in 8dc9d4f7d49bcbeaf4998baf74a4f4459967c1f0
Diffstat (limited to 'framework/Collections')
-rw-r--r--framework/Collections/TAttributeCollection.php13
-rw-r--r--framework/Collections/TMap.php15
2 files changed, 28 insertions, 0 deletions
diff --git a/framework/Collections/TAttributeCollection.php b/framework/Collections/TAttributeCollection.php
index a0f14efd..14a94fbd 100644
--- a/framework/Collections/TAttributeCollection.php
+++ b/framework/Collections/TAttributeCollection.php
@@ -45,6 +45,19 @@ class TAttributeCollection extends TMap
private $_caseSensitive=false;
/**
+ * Returns an array with the names of all variables of this object that should NOT be serialized
+ * because their value is the default one or useless to be cached for the next page loads.
+ * Reimplement in derived classes to add new variables, but remember to also to call the parent
+ * implementation first.
+ */
+ protected function __getZappableSleepProps(&$exprops)
+ {
+ parent::__getZappableSleepProps($exprops);
+ if ($this->_caseSensitive===false)
+ $exprops[] = "\0TAttributeCollection\0_caseSensitive";
+ }
+
+ /**
* Returns a property value or an event handler list by property or event name.
* This method overrides the parent implementation by returning
* a key value if the key exists in the collection.
diff --git a/framework/Collections/TMap.php b/framework/Collections/TMap.php
index d610dce6..a356fe77 100644
--- a/framework/Collections/TMap.php
+++ b/framework/Collections/TMap.php
@@ -42,6 +42,21 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess,Countable
private $_r=false;
/**
+ * Returns an array with the names of all variables of this object that should NOT be serialized
+ * because their value is the default one or useless to be cached for the next page loads.
+ * Reimplement in derived classes to add new variables, but remember to also to call the parent
+ * implementation first.
+ */
+ protected function __getZappableSleepProps(&$exprops)
+ {
+ parent::__getZappableSleepProps($exprops);
+ if ($this->_d===array())
+ $exprops[] = "\0TMap\0_d";
+ if ($this->_r===false)
+ $exprops[] = "\0TMap\0_r";
+ }
+
+ /**
* Constructor.
* Initializes the list with an array or an iterable object.
* @param array|Iterator the intial data. Default is null, meaning no initialization.