class DrupalFlysystemCache in Flysystem 7
An adapter that allows Flysystem to use Drupal's cache system.
Hierarchy
- class \Drupal\flysystem\DrupalFlysystemCache extends \League\Flysystem\Cached\Storage\AbstractCache
Expanded class hierarchy of DrupalFlysystemCache
1 file declares its use of DrupalFlysystemCache
- FlysystemFactory.php in src/
FlysystemFactory.php - Contains \Drupal\flysystem\FlysystemFactory.
File
- src/
DrupalFlysystemCache.php, line 15 - Contains DrupalFlysystemCache.
Namespace
Drupal\flysystemView source
class DrupalFlysystemCache extends AbstractCache {
/**
* The cache key.
*
* @var string
*/
protected $key;
/**
* Constructs a DrupalFlysystemCache object.
*
* @param string $key
* The cache key to use.
*/
public function __construct($key) {
$this->key = $key;
}
/**
* {@inheritdoc}
*/
public function load() {
if ($cache = cache_get($this->key)) {
$this->cache = $cache->data[0];
$this->complete = $cache->data[1];
}
}
/**
* {@inheritdoc}
*/
public function save() {
$cleaned = $this
->cleanContents($this->cache);
cache_set($this->key, array(
$cleaned,
$this->complete,
));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DrupalFlysystemCache:: |
protected | property | The cache key. | |
DrupalFlysystemCache:: |
public | function | ||
DrupalFlysystemCache:: |
public | function | ||
DrupalFlysystemCache:: |
public | function | Constructs a DrupalFlysystemCache object. |