Skip to content

Commit 410b1fa

Browse files
committed
When retrieving a valid entry, bump the entry's expiration timestamp.
1 parent c6a24ca commit 410b1fa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ramcache.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ Card RAMCache::get(Card u) {
3939
for (int i = 0; i < CACHE_CAPACITY; i++) {
4040
CacheEntry *entry = &entries[i];
4141
if (!entry->expired(now)) {
42-
if (entry->card.compare_uid(u)) return entry->card;
42+
if (entry->card.compare_uid(u)) {
43+
entry->touch(now);
44+
return entry->card;
45+
}
4346
}
4447
}
4548
return Card();

0 commit comments

Comments
 (0)