Patent ID: 8924646

Claim:
A method for managing data movement in a multi-level cache system, the multi-level cache system having a primary cache and a secondary cache, the method comprising: initializing the secondary cache, including: configuring the secondary cache to not stage any data initially; and utilizing all metadata from the secondary cache as a ghost cache; determining whether an unallocated space of the primary cache has reached a minimum threshold; selecting at least one outgoing data block from the primary cache when the primary cache has reached the minimum threshold; initiating a de-stage process for de-staging the at least one outgoing data block from the primary cache, the de-stage process comprising: generating metadata regarding the at least one outgoing data block; determining a number of cache hits that have occurred before in the secondary cache, including at least one of: an actual cache hit that has occurred in the secondary cache, wherein a data block for the actual cache hit is stored in the secondary cache; and a ghost cache hit that has occurred in the secondary cache, wherein only metadata regarding the data block for the ghost cache hit is stored in the secondary cache; storing only the metadata regarding the at least one outgoing data block in the secondary cache when the number of cache hits that have occurred before in the secondary cache is below a predetermined threshold; storing the metadata regarding the at least one outgoing data block and the at least one outgoing data block in the secondary cache only under a condition when the number of cache hits that have occurred before in the secondary cache exceeds the predetermined threshold; and deleting the at least one outgoing data block from the primary cache; and terminating the de-stage process when the unallocated space of the primary cache has reached an upper threshold.