| CPC G06F 12/0871 (2013.01) [G06F 12/126 (2013.01)] | 16 Claims |

|
1. A method to allocate a cache in a memory, comprising:
receiving a plurality of requests, each request of the plurality of requests including a request to store respective data to the cache, each request having a respective request size, each respective data being associated with a respective key;
associating the plurality of requests to a set of counters, each counter of the set of counters being associated with a respective data block size that is different than the data block size associated with any other counter of the set of counters, the associating of the plurality of requests to the set of counters including:
for each request:
determining which counter of the set of counters has a smallest associated respective data block size that is at least as large as the respective request size of the request; and
associating a hash of the key associated with the respective data of the request with the determined counter, the hash of the key being a hashed key;
determining a cache size of the cache based on:
a number of unique hashed keys associated with each respective counter of the set of counters; and
the respective data block size of each counter of the set of counters;
and
allocating the cache by reserving, for caching, a portion of the memory, the portion of the memory having a size at least equal to the cache size.
|