コード例 #1
0
std::string GetListOf(
        const std::string& section,
        int64_t minTime,
        int64_t maxTime)
{
    std::string rows;
    for(const auto& item : ReadCacheSection(section))
    {
        const std::string& key = item.first;
        const AppCacheEntry& entry = item.second;

        // Compare age restrictions if specified.
        if((minTime && entry.timestamp <= minTime) ||
           (maxTime && entry.timestamp >= maxTime))
            continue;

        // Skip invalid beacons.
        if (section == "beacon" && Contains("INVESTOR", entry.value))
            continue;

        rows += key + "<COL>" + entry.value + "<ROW>";
    }

    return rows;
}
コード例 #2
0
AppCacheEntry ReadCache(
        const std::string& section,
        const std::string& key)
{
    if (section.empty() || key.empty())
        return AppCacheEntry{ std::string(), 0 };

    const auto& cache = ReadCacheSection(section);
    auto entry = cache.find(key);
    return entry != cache.end()
                   ? entry->second
                   : AppCacheEntry{std::string(), 0};
}
コード例 #3
0
SortedAppCacheSection ReadSortedCacheSection(Section section)
{
    const auto& cache = ReadCacheSection(section);
    return SortedAppCacheSection(cache.begin(), cache.end());
}