You are here

public function AcquiaPurgeService::state in Acquia Purge 7

Retrieve the state storage object.

Return value

AcquiaPurgeStateStorageInterface The state storage backend.

1 call to AcquiaPurgeService::state()
AcquiaPurgeService::queue in lib/AcquiaPurgeService.php
Retrieve the loaded queue backend object.

File

lib/AcquiaPurgeService.php, line 578
Contains AcquiaPurgeService.

Class

AcquiaPurgeService
The Acquia Purge service.

Code

public function state() {

  // Initialize the state storage backend.
  if (is_null($this->state)) {
    _acquia_purge_load('_acquia_purge_state_storage_interface');
    _acquia_purge_load('_acquia_purge_state_storage_base');
    if ($this
      ->hostingInfo()
      ->isMemcachedUsed()) {
      $class = _acquia_purge_load('_acquia_purge_state_storage_memcache');
      $this->state = new $class(ACQUIA_PURGE_STATE_MEMKEY, ACQUIA_PURGE_STATE_MEMBIN);
    }
    else {
      $class = _acquia_purge_load('_acquia_purge_state_storage_disk');
      $this->state = new $class(ACQUIA_PURGE_STATE_FILE);
    }
  }
  return $this->state;
}