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, 23.06.2019 02:00
In the context of an internet connection, llc stands for leased line connection liability limited company local loop complex local loop carrier
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
The more powerful, 60 volt cables and the main power shut-off on an hev are both colored orange.
Answers: 1
question
Computers and Technology, 24.06.2019 01:00
How can the temperature of a room be raised by 5degreesf?
Answers: 1
question
Computers and Technology, 25.06.2019 05:10
Write a program that asks for 'name' from the user and then asks for a number and stores the two in a dictionary (called 'the_dict') as key-value pair. the program then asks if the user wants to enter more data (more data (y/n)? ) and depending on user choice, either asks for another name-number pair or exits and stores the dictionary key, values in a list of tuples and prints the list. note: ignore the case where the name is already in the dictionary. example: name: pranshu number: 517-244-2426 more data (y/n)? y name: rich number: 517-842-5425 more data (y/n)? y name: alireza number: 517-432-5224 more data (y/n)? n [('alireza', '517-432-5224'), ('pranshu', '517-244-2426'), ('rich', '517-842-5425')]
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, 11.05.2021 03:00
question
Mathematics, 11.05.2021 03:00
question
Advanced Placement (AP), 11.05.2021 03:00
question
Mathematics, 11.05.2021 03:00
question
Mathematics, 11.05.2021 03:00
question
Mathematics, 11.05.2021 03:00
Questions on the website: 13722361