void CachedObjectMgr::UpdateCacheFromSS(const std::string &objectID, PySubStream **in_cached_data) { PyCachedObjectDecoder cache; if(!cache.Decode(in_cached_data)) { _log(SERVICE__ERROR, "Failed to decode cache stream"); return; } PyString* str = new PyString( objectID ); PyBuffer* buf = cache.cache->data(); PyIncRef( buf ); _UpdateCache(str, &buf); PyDecRef( str ); }
void CachedObjectMgr::UpdateCache(const PyRep *objectID, PyRep **in_cached_data) { PyRep *cached_data = *in_cached_data; *in_cached_data = NULL; //if(is_log_enabled(SERVICE__CACHE_DUMP)) { // PyLogsysDump dumper(SERVICE__CACHE_DUMP, SERVICE__CACHE_DUMP, false, true); //cached_data->visit(&dumper, 0); //} Buffer* data = new Buffer; bool res = MarshalDeflate( cached_data, *data ); PyDecRef( cached_data ); if( res ) { PyBuffer* buf = new PyBuffer( &data ); _UpdateCache( objectID, &buf ); } else { sLog.Error( "Cached Obj Mgr", "Failed to marshal or deflate new cache object." ); } SafeDelete( data ); }