template<class dictbase, class type>
bool FX::FXLRUCache< dictbase, type >::insert ( KeyTypeAsParam  k,
TypeAsParam  d,
FXint  itemcost = 1 
) [inline, inherited]

Returns:
False if item's cost is bigger than maxCost()
Inserts an item d into the cache under key k with cost itemcost. If the total cost of all the items in the cache exceed maxCost(), the least recently used item is flushed.

Definition at line 193 of file FXLRUCache.h.

00194     {
00195         if(cost>maximum) return false;
00196         FXEXCEPTION_STL1 {
00197             cache.push_front(CacheItem(itemcost, k, d));
00198             cache.front().myit=cache.begin();
00199         } FXEXCEPTION_STL2;
00200         dictbase::insert(k, (DictType) &cache.front());
00201         cost+=itemcost; ++stats.inserted;
00202         dynMax();
00203         return true;
00204     }


(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:37:39 2009 for TnFOX by doxygen v1.4.7