Example #1
0
    def run(self):
        cache = Cache(self.size,self.strategy)
        self.gen_frequencies()
        self.gen_file_list()

        for timeslot in range(self.timeslot):
            self.go_time()
            self.apply_epsilon()
            for hits in range(self.hits):
                choice = self.select_file()
                response = cache.append_item(choice)
                if(response):
                    self.log.insert_log(response,timeslot+1,'hit',cache.get_file_status())
                else:
                    self.log.insert_log(choice,timeslot+1,'miss',cache.get_file_status())
        self.log.end_write()