You are here

public function AcquiaPurgeStateStorageBase::__construct in Acquia Purge 7

Propagate AcquiaPurgeStateItem objects from the given buffer data.

Parameters

mixed $buffer: Raw buffer payload to initialize state data from.

Return value

int The number of items it was able to load from the buffer.

2 calls to AcquiaPurgeStateStorageBase::__construct()
AcquiaPurgeStateStorageDisk::__construct in lib/state/AcquiaPurgeStateStorageDisk.php
Construct AcquiaPurgeStateStorageDisk.
AcquiaPurgeStateStorageMemcache::__construct in lib/state/AcquiaPurgeStateStorageMemcache.php
Construct AcquiaPurgeStateStorageMemcache.
2 methods override AcquiaPurgeStateStorageBase::__construct()
AcquiaPurgeStateStorageDisk::__construct in lib/state/AcquiaPurgeStateStorageDisk.php
Construct AcquiaPurgeStateStorageDisk.
AcquiaPurgeStateStorageMemcache::__construct in lib/state/AcquiaPurgeStateStorageMemcache.php
Construct AcquiaPurgeStateStorageMemcache.

File

lib/state/AcquiaPurgeStateStorageBase.php, line 43
Contains AcquiaPurgeStateStorageBase.

Class

AcquiaPurgeStateStorageBase
Base layer for state storage backends.

Code

public function __construct($buffer) {
  $loaded_items = 0;
  _acquia_purge_load('_acquia_purge_state_item_interface');
  $class = _acquia_purge_load('_acquia_purge_state_item');
  if (is_array($buffer) && count($buffer)) {
    foreach ($buffer as $key => $value) {
      if (!is_string($key)) {
        continue;
      }
      $this->buffer[$key] = $value;
      $this->items[$key] = new $class($this, $key, $value);
      $loaded_items++;
    }
  }
  return $loaded_items;
}