MapCacheLRU: Serialize maxCacheKeys property
Without this, unserializing a MapCacheLRU object results in maxCacheKeys set to null, which causes it to completely empty itself as soon as you try to write to it. Bug: T218511 Change-Id: I77d42b43f4949a24ffb8a58912eef55cc9281e64
This commit is contained in:
parent
396591a485
commit
fb5116028b
1 changed files with 3 additions and 1 deletions
|
|
@ -355,7 +355,8 @@ class MapCacheLRU implements ExpirationAwareness, Serializable {
|
|||
public function serialize() {
|
||||
return serialize( [
|
||||
'entries' => $this->cache,
|
||||
'timestamps' => $this->timestamps
|
||||
'timestamps' => $this->timestamps,
|
||||
'maxCacheKeys' => $this->maxCacheKeys,
|
||||
] );
|
||||
}
|
||||
|
||||
|
|
@ -363,6 +364,7 @@ class MapCacheLRU implements ExpirationAwareness, Serializable {
|
|||
$data = unserialize( $serialized );
|
||||
$this->cache = $data['entries'] ?? [];
|
||||
$this->timestamps = $data['timestamps'] ?? [];
|
||||
$this->maxCacheKeys = $data['maxCacheKeys'] ?? count( $this->cache );
|
||||
$this->epoch = $this->getCurrentTime();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue