Re: [Icarus] Using ttl_cache function in an experiment

From: Ascigil, Onur <>
Date: Tue, 26 Sep 2017 13:23:28 +0000

Hello Meysam,

Sorry for the late reply. You should be able to create and register a policy using TTL caches as you mentioned.

A shortcut would be to generate ttl_cache objects on each node by default in the NetworkModel class. To do that you can replace the lines 394, 395 in icarus/execution/

        self.cache = {node: CACHE_POLICY[policy_name](cache_size[node], **policy_args)
                          for node in cache_size}

with the following two lines:

        self.cache = {node: ttl_cache(CACHE_POLICY[policy_name](cache_size[node], **policy_args), f_time)
                                for node in cache_size}

The f_time is the function you supply to retrieve the current time.

I hope this helps.



On 20 Sep 2017, at 18:13, Meysam Hariri <<>> wrote:


I am trying to use the ttl_cache function with one of the cache policies in a '' experiment scenario configuration file. As far as the instant of a cache is not present in the scenario file I think the only way here is to rewrite a class with ttl_cache implemented in the policies definition file and register it by name. Am I right? Could you please guide me if there is any other way intended for this?


Meysam Hariri
M.Sc. Student in Network Communications
University of Houston
Icarus mailing list<>
Received on Tue Sep 26 2017 - 14:24:46 BST

This archive was generated by hypermail 2.3.0 : Tue Sep 26 2017 - 14:24:49 BST