Example #1
0
ConstCacheObjectPtr Cache::_load( ConstCacheObjectPtr obj )
{
    if( obj->getId() == INVALID_CACHE_ID )
        return ConstCacheObjectPtr();

    return _impl->load( obj );
}
Example #2
0
    ConstCacheObjectPtr load( ConstCacheObjectPtr obj )
    {
        WriteLock writeLock( _mutex );
        const CacheId& cacheId = obj->getId();
        ConstCacheMap::const_iterator it = _cacheMap.find( cacheId );
        if( it != _cacheMap.end( ))
            return it->second;

        _cacheMap[ cacheId ] = obj;
        _statistics.notifyMiss();
        _statistics.notifyLoaded( *obj );
        _policy.insert( cacheId );
        applyPolicy();
        return obj;
    }