From 2192316803564b41a28d56481985597eb5d94fad Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Wed, 15 Dec 2010 15:56:15 -0800 Subject: Modified cache purge entry threshold (part of ER-401) --- indra/newview/llvocache.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra') 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 header_vector; handle_entry_map_t::iterator iter_end = mHandleEntryMap.end(); -- cgit v1.2.3