version 1.7, 2006/11/14 18:34:58
|
version 1.8, 2007/01/10 22:05:56
|
|
|
if (_maxEntries == 0) | if (_maxEntries == 0) |
return; | return; |
| |
_mutex.lock(); |
AutoMutex lock(_mutex); |
| |
//// Update object if it is already in cache: | //// Update object if it is already in cache: |
| |
|
|
{ | { |
// Update the repository. | // Update the repository. |
p->object = object.clone(); | p->object = object.clone(); |
_mutex.unlock(); |
|
return; | return; |
} | } |
} | } |
|
|
_cacheRemoveLRU++; | _cacheRemoveLRU++; |
#endif | #endif |
} | } |
|
|
_mutex.unlock(); |
|
return; |
|
} | } |
| |
template<class OBJECT> | template<class OBJECT> |
|
|
if (_maxEntries == 0) | if (_maxEntries == 0) |
return false; | return false; |
| |
_mutex.lock(); |
AutoMutex lock(_mutex); |
| |
//// Search cache for object. | //// Search cache for object. |
| |
|
|
#ifdef PEGASUS_DEBUG | #ifdef PEGASUS_DEBUG |
_cacheReadHit++; | _cacheReadHit++; |
#endif | #endif |
_mutex.unlock(); |
|
return true; | return true; |
} | } |
} | } |
|
|
#ifdef PEGASUS_DEBUG | #ifdef PEGASUS_DEBUG |
_cacheReadMiss++; | _cacheReadMiss++; |
#endif | #endif |
_mutex.unlock(); |
|
return false; | return false; |
} | } |
| |
|
|
if (_maxEntries == 0) | if (_maxEntries == 0) |
return false; | return false; |
| |
_mutex.lock(); |
AutoMutex lock(_mutex); |
| |
//// Find and remove the given element. | //// Find and remove the given element. |
| |
|
|
delete p; | delete p; |
_numEntries--; | _numEntries--; |
| |
_mutex.unlock(); |
|
return true; | return true; |
} | } |
| |
|
|
| |
//// Not found! | //// Not found! |
| |
_mutex.unlock(); |
|
return false; | return false; |
} | } |
| |