PyResult ObjCacheService::Handle_GetCachableObject(PyCallArgs &call) { CallGetCachableObject args; if(!args.Decode(&call.tuple)) { sLog.Error("Obj Cache Srv", "%s: Unable to decode arguments", call.client->GetName()); return NULL; } if(!_LoadCachableObject(args.objectID)) return NULL; //print done already //should we check their version? I am pretty sure they check it and only request what they want. //well, we want to do something like this, but this doesn't seem to be it. taken // out until we have time to figure out how to properly throw the CacheOK exception. /*if(m_cache.IsCacheUpToDate(args.objectID, args.version, args.timestamp)) { //they throw an exception for "its up to date", lets give it a try... objectCaching_CacheOK except; PyObject *error = except.Encode(); return error; } */ PyObject *result = m_cache.GetCachedObject(args.objectID); return result; }
PyRep *ObjCacheService::GetCacheHint(const PyRep* objectID) { if(!_LoadCachableObject(objectID)) return NULL; //print done already PyObject *cache_hint = m_cache.MakeCacheHint(objectID); if(cache_hint == NULL) { _log(SERVICE__ERROR, "Unable to build cache hint for object ID '%s' (h), skipping.", CachedObjectMgr::OIDToString(objectID).c_str()); return NULL; } return(cache_hint); }
void ObjCacheService::PrimeCache() { CacheKeysMapConstItr cur, end; cur = m_cacheKeys.begin(); end = m_cacheKeys.end(); for(; cur != end; cur++) { PyString* str = new PyString( cur->first ); _LoadCachableObject( str ); PyDecRef( str ); } }