예제 #1
0
PARCHashMap *
parcHashMap_Create(void)
{
    PARCHashMap *result = parcHashMap_CreateCapacity(DEFAULT_CAPACITY);

    return result;
}
예제 #2
0
static void
_athenaLRUContentStore_initializeIndexes(AthenaLRUContentStore *impl, size_t capacityInBytes)
{
    //
    // NOTE: Calculating the number of buckets for the hashmaps is a temporary workaround for
    //       PARCHashMap not yet implementing internal resizing. See BugzId: 3950
    //
    unsigned int numBuckets = _calculateNumberOfInitialBucketsBasedOnCapacityInBytes(capacityInBytes);
    impl->tableByName = parcHashMap_CreateCapacity(numBuckets);
    impl->tableByNameAndKeyId = parcHashMap_CreateCapacity(numBuckets);
    impl->tableByNameAndObjectHash = parcHashMap_CreateCapacity(numBuckets);

    impl->listByRecommendedCacheTime = parcSortedList_CreateCompare(
        (PARCSortedListEntryCompareFunction) _compareByRecommendedCacheTime);
    impl->listByExpiryTime = parcSortedList_CreateCompare((PARCSortedListEntryCompareFunction) _compareByExpiryTime);

    impl->lruHead = NULL;
    impl->lruTail = NULL;

    impl->currentSizeInBytes = 0;
}