Lines Matching refs:cache

141     LruCache<SimpleKey, StringValue> cache(100);
143 EXPECT_EQ(NULL, cache.get(0));
144 EXPECT_EQ(0u, cache.size());
148 LruCache<SimpleKey, StringValue> cache(100);
150 cache.put(1, "one");
151 cache.put(2, "two");
152 cache.put(3, "three");
153 EXPECT_STREQ("one", cache.get(1));
154 EXPECT_STREQ("two", cache.get(2));
155 EXPECT_STREQ("three", cache.get(3));
156 EXPECT_EQ(3u, cache.size());
160 LruCache<SimpleKey, StringValue> cache(2);
162 cache.put(1, "one");
163 cache.put(2, "two");
164 cache.put(3, "three");
165 EXPECT_EQ(NULL, cache.get(1));
166 EXPECT_STREQ("two", cache.get(2));
167 EXPECT_STREQ("three", cache.get(3));
168 EXPECT_EQ(2u, cache.size());
172 LruCache<SimpleKey, StringValue> cache(100);
174 cache.put(1, "one");
175 cache.put(2, "two");
176 cache.put(3, "three");
177 cache.removeOldest();
178 EXPECT_EQ(NULL, cache.get(1));
179 EXPECT_STREQ("two", cache.get(2));
180 EXPECT_STREQ("three", cache.get(3));
181 EXPECT_EQ(2u, cache.size());
185 LruCache<SimpleKey, StringValue> cache(100);
187 cache.put(1, "one");
188 cache.put(2, "two");
189 cache.put(3, "three");
190 EXPECT_STREQ("one", cache.get(1));
191 cache.removeOldest();
192 EXPECT_STREQ("one", cache.get(1));
193 EXPECT_EQ(NULL, cache.get(2));
194 EXPECT_STREQ("three", cache.get(3));
195 EXPECT_EQ(2u, cache.size());
204 LruCache<SimpleKey, StringValue> cache(512);
219 const char *val = cache.get(key);
224 cache.put(key, strings[index]);
230 EXPECT_EQ(kCacheSize, cache.size());
238 ComplexCache cache(100);
240 cache.put(ComplexKey(0), ComplexValue(0));
241 cache.put(ComplexKey(1), ComplexValue(1));
242 EXPECT_EQ(2U, cache.size());
247 ComplexCache cache(100);
249 cache.put(ComplexKey(0), ComplexValue(0));
250 cache.put(ComplexKey(1), ComplexValue(1));
251 EXPECT_EQ(2U, cache.size());
253 cache.clear();
259 ComplexCache cache(100);
261 cache.put(ComplexKey(0), ComplexValue(0));
262 cache.put(ComplexKey(1), ComplexValue(1));
263 EXPECT_EQ(2U, cache.size());
265 cache.removeOldest();
266 cache.clear();
273 ComplexCache cache(100);
275 cache.put(ComplexKey(0), ComplexValue(0));
276 cache.put(ComplexKey(1), ComplexValue(1));
277 EXPECT_EQ(2U, cache.size());
279 cache.clear();
281 cache.put(ComplexKey(0), ComplexValue(0));
282 cache.put(ComplexKey(1), ComplexValue(1));
283 EXPECT_EQ(2U, cache.size());
288 LruCache<SimpleKey, StringValue> cache(100);
290 cache.setOnEntryRemovedListener(&callback);
292 cache.put(1, "one");
293 cache.put(2, "two");
294 cache.put(3, "three");
295 EXPECT_EQ(3U, cache.size());
296 cache.removeOldest();
303 LruCache<SimpleKey, StringValue> cache(100);
305 cache.setOnEntryRemovedListener(&callback);
307 cache.put(1, "one");
308 cache.put(2, "two");
309 cache.put(3, "three");
310 EXPECT_EQ(3U, cache.size());
311 cache.clear();
316 LruCache<KeyWithPointer, StringValue> cache(1);
318 cache.setOnEntryRemovedListener(&callback);
324 cache.put(key1, "one");
325 // As the size of the cache is 1, the put will call the callback.
328 cache.put(key2, "two");
329 EXPECT_EQ(1U, cache.size());
330 EXPECT_STREQ("two", cache.get(key2));
331 cache.clear();
335 LruCache<int, int> cache(100);
337 cache.put(1, 4);
338 cache.put(2, 5);
339 cache.put(3, 6);
340 EXPECT_EQ(3U, cache.size());
342 LruCache<int, int>::Iterator it(cache);
355 LruCache<int, int> cache(100);
357 LruCache<int, int>::Iterator it(cache);
367 LruCache<int, int> cache(100);
368 cache.put(1, 2);
370 LruCache<int, int>::Iterator it(cache);
379 LruCache<int, int> cache(100);
380 cache.put(1, 2);
382 cache.remove(1);
384 LruCache<int, int>::Iterator it(cache);
393 LruCache<int, int> cache(100);
394 cache.put(1, 4);
395 cache.put(2, 5);
396 cache.put(3, 6);
398 cache.remove(2);
400 LruCache<int, int>::Iterator it(cache);
409 LruCache<int, int> cache(100);
410 cache.put(1, 4);
411 cache.put(2, 5);
412 cache.put(3, 6);
414 cache.remove(3);
416 LruCache<int, int>::Iterator it(cache);
425 LruCache<int, int> cache(100);
426 cache.put(1, 4);
427 cache.put(2, 5);
428 cache.put(3, 6);
430 cache.remove(7);
432 LruCache<int, int>::Iterator it(cache);