-
Notifications
You must be signed in to change notification settings - Fork 166
Description
Sir how to implement caching in content store. It always shows cache miss and cache hits 00000000 during content tracing log file
like
when I run this program in ndnSIM
// ndn-congestion-topo-plugin.cpp
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/ndnSIM-module.h"
namespace ns3 {
int
main(int argc, char* argv[])
{
CommandLine cmd;
cmd.Parse(argc, argv);
AnnotatedTopologyReader topologyReader("", 25);
topologyReader.SetFileName("src/ndnSIM/examples/topologies/topo-6-node.txt");
topologyReader.Read();
// Install NDN stack on all nodes
ndn::StackHelper ndnHelper;
ndnHelper.SetOldContentStore("ns3::ndn::cs::Lru", "MaxSize", "10000");
ndnHelper.InstallAll();
// Choosing forwarding strategy
ndn::StrategyChoiceHelper::InstallAll("/prefix", "/localhost/nfd/strategy/best-route");
// Installing global routing interface on all nodes
ndn::GlobalRoutingHelper ndnGlobalRoutingHelper;
ndnGlobalRoutingHelper.InstallAll();
// Getting containers for the consumer/producer
Ptr consumer1 = Names::Find("Src1");
Ptr consumer2 = Names::Find("Src2");
Ptr producer1 = Names::Find("Dst1");
Ptr producer2 = Names::Find("Dst2");
ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr");
consumerHelper.SetAttribute("Frequency", StringValue("100")); // 100 interests a second
// on the first consumer node install a Consumer application
// that will express interests in /dst1 namespace
consumerHelper.SetPrefix("/dst1");
consumerHelper.Install(consumer1);
// on the second consumer node install a Consumer application
// that will express interests in /dst2 namespace
consumerHelper.SetPrefix("/dst2");
consumerHelper.Install(consumer2);
ndn::AppHelper producerHelper("ns3::ndn::Producer");
producerHelper.SetAttribute("PayloadSize", StringValue("1024"));
// Register /dst1 prefix with global routing controller and
// install producer that will satisfy Interests in /dst1 namespace
ndnGlobalRoutingHelper.AddOrigins("/dst1", producer1);
producerHelper.SetPrefix("/dst1");
producerHelper.Install(producer1);
// Register /dst2 prefix with global routing controller and
// install producer that will satisfy Interests in /dst2 namespace
ndnGlobalRoutingHelper.AddOrigins("/dst2", producer2);
producerHelper.SetPrefix("/dst2");
producerHelper.Install(producer2);
// Calculate and install FIBs
ndn::GlobalRoutingHelper::CalculateRoutes();
Simulator::Stop(Seconds(20.0));
Simulator::Run();
Simulator::Destroy();
return 0;
}
} // namespace ns3
int
main(int argc, char* argv[])
{
return ns3::main(argc, argv);
}
it shows the output of file cs-trace.txt
Time Node Type Packets
1 Src1 CacheHits 0
1 Src1 CacheMisses 0
1 Src2 CacheHits 0
1 Src2 CacheMisses 0
1 Rtr1 CacheHits 0
1 Rtr1 CacheMisses 0
1 Rtr2 CacheHits 0
1 Rtr2 CacheMisses 0
1 Dst1 CacheHits 0
1 Dst1 CacheMisses 0
1 Dst2 CacheHits 0
1 Dst2 CacheMisses 0
2 Src1 CacheHits 0
2 Src1 CacheMisses 0
2 Src2 CacheHits 0
2 Src2 CacheMisses 0
2 Rtr1 CacheHits 0
2 Rtr1 CacheMisses 0
2 Rtr2 CacheHits 0
2 Rtr2 CacheMisses 0
2 Dst1 CacheHits 0