The cache created by actions/cache is restricted by branch. A workflow run on a branch can restore caches created by that same branch and caches created by the repository's default branch. It cannot read a cache created by any other branch, and a pull request run is scoped to the merge ref, not to the head branch.
The consequence is that a long-lived feature branch never benefits from another feature branch's warm cache, and a pull request opened from a fork cannot read the base repository's caches at all. A first run on a new branch is always a cold cache unless a restore-keys prefix matches something on the default branch.
The practical arrangement is to run a scheduled or push-triggered job on the default branch that populates the cache under a stable prefix, then rely on restore-keys for partial matches everywhere else. Caches are evicted after seven days without access, and the repository total is capped at ten gigabytes with least-recently-used eviction once the cap is reached, so an over-eager cache key can evict the entries that matter.