mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core: LRUCache::GetLRUKey (thanks fermium)
git-svn-id: svn://ultimatepp.org/upp/trunk@12436 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
e4283242db
commit
032e5ae255
2 changed files with 18 additions and 4 deletions
|
|
@ -376,9 +376,10 @@ public:
|
|||
|
||||
template <class P> void AdjustSize(P getsize);
|
||||
|
||||
T& GetLRU();
|
||||
void DropLRU();
|
||||
void Shrink(int maxsize, int maxcount = 30000);
|
||||
T& GetLRU();
|
||||
const K& GetLRUKey();
|
||||
void DropLRU();
|
||||
void Shrink(int maxsize, int maxcount = 30000);
|
||||
|
||||
template <class P> int Remove(P predicate);
|
||||
template <class P> bool RemoveOne(P predicate);
|
||||
|
|
@ -434,6 +435,13 @@ T& LRUCache<T, K>::GetLRU()
|
|||
return *data[tail].data;
|
||||
}
|
||||
|
||||
template <class T, class K>
|
||||
const K& LRUCacheKeyRet<T, K>::GetLRUKey()
|
||||
{
|
||||
int tail = data[head].prev;
|
||||
return key[tail].key;
|
||||
}
|
||||
|
||||
template <class T, class K>
|
||||
void LRUCache<T, K>::DropLRU()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
topic "LRUCache";
|
||||
[2 $$0,0#00000000000000000000000000000000:Default]
|
||||
[i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class]
|
||||
[l288;2 $$2,2#27521748481378242620020725143825:desc]
|
||||
[0 $$3,0#96390100711032703541132217272105:end]
|
||||
|
|
@ -9,6 +8,7 @@ topic "LRUCache";
|
|||
[l288;i1121;b17;O9;~~~.1408;2 $$7,0#10431211400427159095818037425705:param]
|
||||
[i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam]
|
||||
[b42;2 $$9,9#13035079074754324216151401829390:normal]
|
||||
[2 $$0,0#00000000000000000000000000000000:Default]
|
||||
[{_}
|
||||
[ {{10000@(113.42.0) [s0;%% [*@7;4 LRUCache]]}}&]
|
||||
[s1;@(0.0.255)3 &]
|
||||
|
|
@ -75,6 +75,12 @@ parameter) to retrieve the size of individual data items.&]
|
|||
the cache (candidate for removal).&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:Upp`:`:LRUCache`:`:GetLRUKey`(`): [@(0.0.255) const]_[*@4 K][@(0.0.255) `&]_[* GetLRUKey
|
||||
]()&]
|
||||
[s2;%% Returns the key of the least recently used data item in the
|
||||
cache (candidate for removal).&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:LRUCache`:`:DropLRU`(`): [@(0.0.255) void]_[* DropLRU]()&]
|
||||
[s2;%% Removes the least recently used data item from the cache.&]
|
||||
[s3; &]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue