renommer data en key
This commit is contained in:
parent
7d332552ab
commit
5eb376257f
17
php/src/cache/CacheFile.php
vendored
17
php/src/cache/CacheFile.php
vendored
@ -178,13 +178,14 @@ class CacheFile extends SharedFile {
|
||||
}
|
||||
|
||||
protected function afterAction() {
|
||||
# égalité non stricte pour start et duration
|
||||
$modified = false;
|
||||
if ($this->start != $this->ostart) $modified = true;
|
||||
$duration = $this->duration;
|
||||
$oduration = $this->oduration;
|
||||
if ($duration === null || $oduration === null) $modified = true;
|
||||
elseif ($duration->getDest() != $oduration->getDest()) $modified = true;
|
||||
# égalité stricte uniquement pour $data et $datafiles
|
||||
# égalité stricte pour $data
|
||||
if ($this->data !== $this->odata) $modified = true;
|
||||
if ($modified && !$this->readonly) {
|
||||
$this->lockWrite();
|
||||
@ -288,20 +289,20 @@ class CacheFile extends SharedFile {
|
||||
return $this;
|
||||
}
|
||||
|
||||
function get($data=null, bool $noCache=false) {
|
||||
return $this->action(function () use ($data, $noCache) {
|
||||
return $this->refreshData($data, $noCache);
|
||||
function get($key=null, bool $noCache=false) {
|
||||
return $this->action(function () use ($key, $noCache) {
|
||||
return $this->refreshData($key, $noCache);
|
||||
});
|
||||
}
|
||||
|
||||
function all($data=null, bool $noCache=false): ?iterable {
|
||||
$data = $this->get($data, $noCache);
|
||||
function all($key=null, bool $noCache=false): ?iterable {
|
||||
$data = $this->get($key, $noCache);
|
||||
if ($data !== null && !is_iterable($data)) $data = [$data];
|
||||
return $data;
|
||||
}
|
||||
|
||||
function delete($data=null): void {
|
||||
$source = $this->sources[$data] ?? null;
|
||||
function delete($key=null): void {
|
||||
$source = $this->sources[$key] ?? null;
|
||||
if ($source !== null) $source->delete();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user