subject

The cache lists (linked lists): each level within the cache directory, the actual cache is stored as a linked list object. you will use the cachelist() class to implement this linked list. each cache has a maximum size of 200 ( note that this does not mean there can be a maximum of 200 items in the cache. it means that the sum of the sizes of all content objects in a cache cannot exceed 200). do not change this value. there are 5 functions you must implement yourself.

• def put(self, content, evictionpolicy) :

this function puts content into your cache. as explained earlier, caches should make information readily available to a user. accordingly, you should always insert new content at the front of your list so it is easy to obtain. o you should be checking to make sure that your content is not bigger than the maximum size, in that case it should not be inserted. o accordingly, you should also make sure there is enough space remaining in the cache to insert your content. if there is not enough space, you need to evict content currently in the cache. you must keep removing content until there is enough space to insert the new content (so long as the new content is not bigger than the maximum size). there are two ways to do this: lru or mru. ▪ lru: least recently used • remove the content that was last added to the list ▪ mru: most recently used • remove the content that was most recently added to the list o these eviction policies will be specified when the hashtable’s insert function is called. it will be passed as a string parameter ‘lru’ or ‘mru’.

• def lruevict(self)/def mruevict(self) :

as explained previously you will have to implement these specialized removal functions yourself to remove content from the list based on when it was used (in this case added). o this does not need to return a value.

• def find(self) :

this function should be able to find and return a content object from a cache. if it is not found, it should return none.

• def clear(self) :

this function should remove every single item in a cache, and reset the cache’s size and number of items. when all items are removed, it should return a message indicating so. this is shown in the doctests.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:00
Which action is good business etiquette? a. switching your cell phone off before you enter a meeting b. keeping your cell phone on low volume before you enter a meeting c. setting a pleasant ring tone on your cell phone before you enter a meeting d. setting a standard ringtone on your cell phone before you enter a meeting
Answers: 1
question
Computers and Technology, 22.06.2019 12:30
What characteristic of long period comets suggest they come directly from the oort cloud?
Answers: 2
question
Computers and Technology, 23.06.2019 21:40
Draw the resistor’s voltage and current phasors at t=15ms. draw the vectors with their tails at the origin. the orientation of your vectors will be graded. the exact length of your vectors will not be graded.
Answers: 2
question
Computers and Technology, 24.06.2019 12:50
Write a new lc-3 trap subroutine (i.e. a subroutine that will be invoked via the trap instruction) that will receive a numeric digit entered at the keyboard (i.e. an ascii character), echo it to the screen, and return in r0 the corresponding numeric value: so if the user types the digit '7', the character '7' will appear on the screen, but the value returned in r0 will be b0000 0000 0000 0111 (#7) you may not use any trap calls in your code - you must implement the "polling" code that interrogates the keyboard status and data registers. ; getnum_tsr ; a subroutine for obtaining a numeric value ; given ascii numeric digit input to keyboard. ; the numeric digit is echoed to the console (e.g. '7' = b0000 0000 0011 0111), ; but the value returned in r0 is the actual numeric value ; corresponding to the digit (e.g. b0000 0000 0000 0111 =
Answers: 3
You know the right answer?
The cache lists (linked lists): each level within the cache directory, the actual cache is stored a...
Questions
question
Mathematics, 08.07.2019 23:30