33 ms·
I did, the only part my code sample doesn't involve is expiring the oldest record, which is: void expire(node_t **head) { node_t *next = (*head)->next;
by strlen 16y ago
I did, the only part my code sample doesn't involve is expiring the oldest record, which is:
void expire(node_t **head) {
node_t *next = (*head)->next;
free(*head);
*head = next;
}
In terms of using a linked list as an LRU cache, this is done in the Java SDK by LinkedHashMap:
http://download.oracle.com/javase/6/docs/api/java/util/LinkedHashMap.html http://download.oracle.com/javase/6/docs/api/java/util/Linke...
http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/LinkedHashMap.java http://grepcode.com/file/repository.grepcode.com/java/root/j...
- piotrSikora 16y agoExcept that the patent doesn't do any "expiring of the oldest record" and it's not LRU.