Computers and Technology

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.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 07:30, ghopk5929
In the film "epic 2015," epic is the name for:
Answers: 3
image
Computers and Technology, 23.06.2019 10:00, uwunuzzles
How do i delete my account on this because i didn't read this agreements and also i put age at xd
Answers: 1
image
Computers and Technology, 23.06.2019 19:00, amayax77
Write a program that displays the following menu: geometry calculator 1. calculate the area of a circle 2. calculate the area of a rectangle 3. calculate the area of a triangle 4. quit enter your choice (1-4): if the user enters 1, the program should ask for the radius of the circle and then display its area. use the following formula: area = ď€(the square of r) use 3.14159 for ď€ and the radius of the circle for r. if the user enters 2, the program should ask for the length and width of the rectangle and then display the rectangle’s area. use the following formula: area = length * width if the user enters 3, the program should ask for the length of the triangle’s base and its height, and then display its area. use the following formula: area = base * height * .5 if the user enters 4, the program should end. input validation: display an error message if the user enters a number outside the range of 1 through 4 when selecting an item from the menu. do not accept negative values for the circle’s radius, the rectangle’s length or width, or the triangle’s base or height. note: if the user enters an improper menu choice (1-4), the program prints "the valid choices are 1 through 4. run the program again and select one of those." if the user enters a negative radius, the program prints "the radius can not be less than zero." if the user enters a negative value for height or base, the program prints "only enter positive values for base and height."
Answers: 1
image
Computers and Technology, 24.06.2019 10:20, savyblue1724707
Identify the publisher in this citation: carter, alan. a guide to entrepreneurship. new york: river’2008.print.
Answers: 3
Do you know the correct answer?
The cache lists (linked lists): each level within the cache directory, the actual cache is stored a...

Questions in other subjects:

Konu
Social Studies, 17.04.2020 18:56