主权项 |
1. A cache management method for a non-volatile storage device, wherein the method is applied to a cache system based on the non-volatile storage device, the cache system comprising a cache, the non-volatile storage device, and a cache management apparatus, wherein the cache is configured to store page data read from the non-volatile storage device and page data to be written into the non-volatile storage device, wherein the cache comprises a clean page subpool and a dirty page subpool, wherein the non-volatile storage device is configured to store all page data, and wherein the cache management apparatus uses management information to manage the cache, wherein the management information comprises a clean page subpool capacity threshold, page information of the clean page subpool, a history list of clean pages, page information of the dirty page subpool, and a history list of dirty pages, and wherein the page information comprises a subpool capacity, the history list of clean pages is configured to store identification information of a historical clean page that is recently displaced from the cache, and the history list of dirty pages is configured to store identification information of a historical dirty page that is recently displaced from the cache, wherein the method comprises:
determining that a to-be-accessed page is neither in the clean page subpool nor in the dirty page subpool; determining a size relationship between a capacity sum of the clean page subpool and the dirty page subpool and a cache capacity; determining that the capacity sum of the clean page subpool and the dirty page subpool is equal to the cache capacity; determining whether identification information of the to-be-accessed page is in the history list of clean pages or the history list of dirty pages; adding a first adjustment value to the clean page subpool capacity threshold when it is determined that the identification information of the to-be-accessed page is in the history list of clean pages; and subtracting a second adjustment value from the clean page subpool capacity threshold when the identification information of the to-be-accessed page is in the history list of dirty pages. |