46 foreach ( $entities as $entity ) {
47 $entitiesByKey[$this->getStoreKey(
$type, $entity )] = $entity;
50 $blobsByKey = $this->stash->getMulti( array_keys( $entitiesByKey ) );
53 foreach ( $entitiesByKey as $key => $entity ) {
54 $blob = $blobsByKey[$key] ??
null;
55 $data = is_string(
$blob ) ? json_decode(
$blob,
true ) :
null;
57 $data[self::KEY_PATHS] ?? [],
58 $data[self::KEY_AS_OF] ??
null
67 foreach ( $dataByEntity as $entity => $data ) {
68 if ( !is_array( $data[self::KEY_PATHS] ) || !is_int( $data[self::KEY_AS_OF] ) ) {
69 throw new InvalidArgumentException(
"Invalid entry for '$entity'" );
73 $data[self::KEY_PATHS] = array_values( array_unique( $data[self::KEY_PATHS] ) );
74 sort( $data[self::KEY_PATHS], SORT_STRING );
76 $blob = json_encode( $data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );
77 $blobsByKey[$this->getStoreKey(
$type, $entity )] =
$blob;
81 $this->stash->setMulti( $blobsByKey, $ttl, BagOStuff::WRITE_BACKGROUND );