diff options
author | Don Kjer <don@lindenlab.com> | 2010-12-15 15:56:15 -0800 |
---|---|---|
committer | Don Kjer <don@lindenlab.com> | 2010-12-15 15:56:15 -0800 |
commit | 2192316803564b41a28d56481985597eb5d94fad (patch) | |
tree | 2ae6791059d889aa3f7d4e2451573f137edd0b0e /indra | |
parent | 3e1f2083abe31d54b4b57ac7e8479b79461f6062 (diff) |
Modified cache purge entry threshold (part of ER-401)
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llvocache.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 6ea88abab8..10744991f4 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -225,7 +225,8 @@ BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const // Format string used to construct filename for the object cache static const char OBJECT_CACHE_FILENAME[] = "objects_%d_%d.slc"; -const U32 NUM_ENTRIES_TO_PURGE = 50; +// Throw out 1/20 (5%) of our cache entries if we run out of room. +const U32 ENTRIES_PURGE_FACTOR = 20; const char* object_cache_dirname = "objectcache"; const char* header_filename = "object.cache"; @@ -592,7 +593,8 @@ void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::voca void LLVOCache::purgeEntries() { - U32 limit = mCacheSize - NUM_ENTRIES_TO_PURGE ; + U32 limit = mCacheSize / ENTRIES_PURGE_FACTOR; + limit = llclamp(limit, 1, mCacheSize); // Construct a vector of entries out of the map so we can sort by time. std::vector<HeaderEntryInfo*> header_vector; handle_entry_map_t::iterator iter_end = mHandleEntryMap.end(); |