It's possible for a PDF page to have multiple resource dictionaries which could have patterns (shading or tiling) that have the same names. Our cache currently works off of name, so we could potentially be caching one pattern and retrieving the wrong one if the name is the same, but the resource dictionary has changed.

I'm not aware of any PDFs affected by this issue, but issue6737.pdf has an example of this with radial shadings. There are two patterns `P1` and `P2` which each have their own resource dictionaries. Each of those resource dictionaries has a pattern named `Sh0`, but they are different shadings.  
/* Copyright 2019 Mozilla Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { assert, shadow, unreachable, warn } from "../shared/util.js";
import { RefSetCache } from "./primitives.js";
class BaseLocalCache {