Re: [Icarus] Using ttl_cache function in an experiment

From: Ascigil, Onur <o.ascigil_at_ucl.ac.uk>
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/network.py:


        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.

Best,

Onur

On 20 Sep 2017, at 18:13, Meysam Hariri <meysam.hariri_at_gmail.com<mailto:meysam.hariri_at_gmail.com>> wrote:

Hello,

I am trying to use the ttl_cache function with one of the cache policies in a 'config.py' 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?

Thanks,

Meysam Hariri
M.Sc. Student in Network Communications
University of Houston
_______________________________________________
Icarus mailing list
Icarus_at_ee.ucl.ac.uk<mailto:Icarus_at_ee.ucl.ac.uk>
http://mailman.ee.ucl.ac.uk/mailman/listinfo/icarus
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