venediktov / vanilla-rtb

Real Time Bidding (RTB) - Demand Side Platform framework
http://forkbid.com
GNU General Public License v3.0
318 stars 85 forks source link

Merge loader and loader_experimental #77

Closed venediktov closed 6 years ago

venediktov commented 6 years ago

We don't need a separate loader for ico targeting , just add a REST handler and ico caches to examples/loader/cache_loader_test.cpp and separate map

dispatcher.crud_match(boost::regex("/ico_cache_loader/(\\w*)"))
              .put([&](http::server::reply & r, const http::crud::crud_match<boost::cmatch> & match) {
              LOG(info) << "received cache update event url=" << match[0];
              try {
                  ico_caches[match[1]]();
              } catch (std::exception const& e) {
                  LOG(error) << e.what();
              }
    });

Also add map for ico targeting model

std::map<std::string, std::function<void()>> ico_caches = {
        {"domain" , [&domain_cache](){geo_ad_cache.load();}},
        {"ico_campaign", [&ico_campaign_cache](){co_campaign_cache.load();}   },
        {"ad"     , [&ad_cache](){ad_cache.load();}    },
        {""       , [&ico_bidder_caches] (){ico_bidder_caches.load();}    }
    };