class AcquiaPurgeStateStorageDisk in Acquia Purge 7
File backed state storage.
Hierarchy
- class \AcquiaPurgeStateStorageBase implements AcquiaPurgeStateStorageInterface
- class \AcquiaPurgeStateStorageDisk
Expanded class hierarchy of AcquiaPurgeStateStorageDisk
File
- lib/
state/ AcquiaPurgeStateStorageDisk.php, line 11 - Contains AcquiaPurgeStateStorageDisk.
View source
class AcquiaPurgeStateStorageDisk extends AcquiaPurgeStateStorageBase {
/**
* The raw payload to compare changes against.
*
* @var string
*/
protected $raw = '';
/**
* The URI identifier to the file (on disk) to store state data in.
*
* @var string
*/
protected $uri;
/**
* Construct AcquiaPurgeStateStorageDisk.
*
* @param string $uri
* The URI identifier to the file (on disk) to store state data in.
*/
public function __construct($uri) {
$this->uri = $uri;
if (file_exists($this->uri)) {
if ($buffer = file_get_contents($this->uri)) {
if (parent::__construct(unserialize($buffer))) {
$this->raw = $buffer;
}
}
}
}
/**
* {@inheritdoc}
*/
public function commit() {
if (!$this->commit) {
return;
}
else {
$this->commit = FALSE;
}
$raw_new = serialize($this->buffer);
if ($raw_new !== $this->raw) {
$this->raw = $raw_new;
file_put_contents($this->uri, $this->raw);
}
}
/**
* {@inheritdoc}
*/
public function wipe() {
parent::wipe();
$this->raw = '';
if (file_exists($this->uri)) {
drupal_unlink($this->uri);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AcquiaPurgeStateStorageBase:: |
protected | property | The payload buffer which gets synchronized with memcached. | |
AcquiaPurgeStateStorageBase:: |
protected | property | Indicates if ::commit() has been registered to be called at shutdown. | |
AcquiaPurgeStateStorageBase:: |
protected | property | Item instances. | |
AcquiaPurgeStateStorageBase:: |
public | function |
Retrieve the object named $key. Overrides AcquiaPurgeStateStorageInterface:: |
|
AcquiaPurgeStateStorageBase:: |
public | function |
Retrieve a counter object named $key. Overrides AcquiaPurgeStateStorageInterface:: |
|
AcquiaPurgeStateStorageBase:: |
public | function |
Store the state item in state item storage. Overrides AcquiaPurgeStateStorageInterface:: |
|
AcquiaPurgeStateStorageDisk:: |
protected | property | The raw payload to compare changes against. | |
AcquiaPurgeStateStorageDisk:: |
protected | property | The URI identifier to the file (on disk) to store state data in. | |
AcquiaPurgeStateStorageDisk:: |
public | function |
Commit the state data to its persistent storage location. Overrides AcquiaPurgeStateStorageInterface:: |
|
AcquiaPurgeStateStorageDisk:: |
public | function |
Wipe all state data. Overrides AcquiaPurgeStateStorageBase:: |
|
AcquiaPurgeStateStorageDisk:: |
public | function |
Construct AcquiaPurgeStateStorageDisk. Overrides AcquiaPurgeStateStorageBase:: |