Flash caches have been widely deployed in cloud computing environments to boost the performance of virtual machines (VMs), but they are usually oversubscribed among the VMs due to the limited cache space compared to the VMs’ working set (WS) size, making the cache allocation a challenging problem. Miss Ratio Curves (MRCs) can be used to manage cache partitioning among the VMs; however, traditional WS-based MRCs are constructed based on all the data, including the data without good locality, which forces the VMs to allocate unnecessary cache space to achieve their objective performance. The paper presents QCache, a locality-driven solution for MRC construction and cache allocation. First, it proposes a new design of MRC, RWS-based MRCs, which is constructed based on the reuse working set and guides the cache allocation based on the good-locality data. Second, with RWS-based MRCs, it provides two different algorithms to optimize the cache allocation among all the VMs, regarding the improvement of the overall performance and the optimization for each VM’s Quality-of-Service respectively.