[ndnSIM] How to add a new cache replacement policy

Alex Afanasyev aa at CS.UCLA.EDU
Wed Nov 11 01:54:50 PST 2015

> On Nov 6, 2015, at 5:28 AM, Saran Tarnoi <sarantarnoi at gmail.com> wrote:
> Dear All,
> I want to add a new cache replacement policy to ndnSIM. Until now, I have been hard-coding existing files, such as lru-policy.h, to get a desired result. This method is obviously inefficient for real simulation.
> I would like to have a separate new policy file and make it callable from scenario files through a configuration in ndnHealper. For example, the following line of a scenario file allows CS to run NewPolicy.
> ndnHelper.SetOldContentStore("ns3::ndn::cs::NewPolicy", "MaxSize", "10000");
> Which files do I should modify to get this ability?

Hi Saran,

Just create your new policy file, and then in src/ndnSIM/model/cs/content-store-impl.cpp  add the following:

template class ContentStoreImpl<your_policy_traits>;
NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, your_policy_traits);

Essentially, you need to instantiate a new content policy class with your policy.  After the class is instantiated, you can use it in ndnHelper.


> Your answers will be highly appreciated.
> Thank you.
> --
> Yours sincerely,
> Saran
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20151111/a3a03313/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20151111/a3a03313/attachment.bin>

More information about the ndnSIM mailing list