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 07:30
Events and conditions that happen within an organization that are somewhat easier to deal with when responding to change are called
Answers: 1
question
Computers and Technology, 22.06.2019 20:00
Which location-sharing service offers items for users as a gaming component and also allows them to collectively link their check-ins to publish a trip? a. whrrl b. buzzd c. foursquare (this option is wrong i already tried) d. gowalla for plato
Answers: 2
question
Computers and Technology, 23.06.2019 13:00
Donnie does not have powerpoint. which method would be best for elana to save and share her presentation as is? a pdf a doc an rtf a ppt
Answers: 3
question
Computers and Technology, 24.06.2019 00:40
Use a software program or a graphing utility with matrix capabilities to solve the system of linear equations using an inverse matrix. x1 + 2x2 − x3 + 3x4 − x5 = 6 x1 − 3x2 + x3 + 2x4 − x5 = −6 2x1 + x2 + x3 − 3x4 + x5 = 3 x1 − x2 + 2x3 + x4 − x5 = −3 2x1 + x2 − x3 + 2x4 + x5 = 5
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, 09.09.2021 02:40
question
Mathematics, 09.09.2021 02:40
question
Mathematics, 09.09.2021 02:40
question
History, 09.09.2021 02:40
question
Biology, 09.09.2021 02:40
question
Mathematics, 09.09.2021 02:40
question
Mathematics, 09.09.2021 02:40
Questions on the website: 13722360