diff options
author | dolphin <dolphin@lindenlab.com> | 2014-03-17 15:57:15 -0700 |
---|---|---|
committer | dolphin <dolphin@lindenlab.com> | 2014-03-17 15:57:15 -0700 |
commit | 74dcc04e69b845e62d25e83b615399f8a5d26d21 (patch) | |
tree | 7b951b6c770cb41d4f5787f92d828cf5e5b86bd5 /indra/llmessage | |
parent | e10ae3ba960cf030582378c454937dd326fcd436 (diff) |
Updated experience cache to get a const reference to xp data
Diffstat (limited to 'indra/llmessage')
-rw-r--r-- | indra/llmessage/llexperiencecache.cpp | 21 | ||||
-rw-r--r-- | indra/llmessage/llexperiencecache.h | 2 |
2 files changed, 10 insertions, 13 deletions
diff --git a/indra/llmessage/llexperiencecache.cpp b/indra/llmessage/llexperiencecache.cpp index 648e2039a6..c8deaac1ef 100644 --- a/indra/llmessage/llexperiencecache.cpp +++ b/indra/llmessage/llexperiencecache.cpp @@ -320,9 +320,9 @@ namespace LLExperienceCache for ( ; it != mKeys.end(); ++it) { - LLSD exp; + LLSD exp = get(it->first); //leave the properties alone if we already have a cache entry for this xp - if(!get(it->first, exp)) + if(exp.isUndefined()) { exp[PROPERTIES]=PROPERTY_INVALID; } @@ -563,24 +563,21 @@ namespace LLExperienceCache LL_WARNS("ExperienceCache") << ": Ignoring cache insert of experience which is missing " << EXPERIENCE_ID << LL_ENDL; } } - - bool get( const LLUUID& key, LLSD& experience_data ) + static LLSD empty; + const LLSD& get(const LLUUID& key) { - if(key.isNull()) return false; + if(key.isNull()) return empty; cache_t::const_iterator it = sCache.find(key); - + if (it != sCache.end()) { - experience_data = it->second; - return true; + return it->second; } - + fetch(key); - return false; + return empty; } - - void get( const LLUUID& key, callback_slot_t slot ) { if(key.isNull()) return; diff --git a/indra/llmessage/llexperiencecache.h b/indra/llmessage/llexperiencecache.h index e6129796b7..e669ee888e 100644 --- a/indra/llmessage/llexperiencecache.h +++ b/indra/llmessage/llexperiencecache.h @@ -89,7 +89,7 @@ namespace LLExperienceCache void erase(const LLUUID& key); bool fetch(const LLUUID& key, bool refresh=false); void insert(const LLSD& experience_data); - bool get(const LLUUID& key, LLSD& experience_data); + const LLSD& get(const LLUUID& key); // If name information is in cache, callback will be called immediately. void get(const LLUUID& key, callback_slot_t slot); |