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() {
|
protected function afterAction() {
|
||||||
|
# égalité non stricte pour start et duration
|
||||||
$modified = false;
|
$modified = false;
|
||||||
if ($this->start != $this->ostart) $modified = true;
|
if ($this->start != $this->ostart) $modified = true;
|
||||||
$duration = $this->duration;
|
$duration = $this->duration;
|
||||||
$oduration = $this->oduration;
|
$oduration = $this->oduration;
|
||||||
if ($duration === null || $oduration === null) $modified = true;
|
if ($duration === null || $oduration === null) $modified = true;
|
||||||
elseif ($duration->getDest() != $oduration->getDest()) $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 ($this->data !== $this->odata) $modified = true;
|
||||||
if ($modified && !$this->readonly) {
|
if ($modified && !$this->readonly) {
|
||||||
$this->lockWrite();
|
$this->lockWrite();
|
||||||
@ -288,20 +289,20 @@ class CacheFile extends SharedFile {
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get($data=null, bool $noCache=false) {
|
function get($key=null, bool $noCache=false) {
|
||||||
return $this->action(function () use ($data, $noCache) {
|
return $this->action(function () use ($key, $noCache) {
|
||||||
return $this->refreshData($data, $noCache);
|
return $this->refreshData($key, $noCache);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function all($data=null, bool $noCache=false): ?iterable {
|
function all($key=null, bool $noCache=false): ?iterable {
|
||||||
$data = $this->get($data, $noCache);
|
$data = $this->get($key, $noCache);
|
||||||
if ($data !== null && !is_iterable($data)) $data = [$data];
|
if ($data !== null && !is_iterable($data)) $data = [$data];
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete($data=null): void {
|
function delete($key=null): void {
|
||||||
$source = $this->sources[$data] ?? null;
|
$source = $this->sources[$key] ?? null;
|
||||||
if ($source !== null) $source->delete();
|
if ($source !== null) $source->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user