Home | History | Annotate | Download | only in provider

Lines Matching defs:cache

177         // The underlying cursor shouldn't be closed because it's in a cache (we'll test
205 // Create a cache of size 2
206 ContentCache cache = new ContentCache("Name", SIMPLE_PROJECTION, 2);
210 CacheToken token = cache.getCacheToken("1");
211 // Put the cursor in the cache
212 cache.putCursor(cursor1, "1", SIMPLE_PROJECTION, token);
213 assertEquals(1, cache.size());
218 token = cache.getCacheToken("2");
219 // Put the cursor in the cache
220 cache.putCursor(cursor1, "2", SIMPLE_PROJECTION, token);
221 assertEquals(2, cache.size());
223 // We should be able to find both now in the cache
224 Cursor cachedCursor = cache.getCachedCursor("1", SIMPLE_PROJECTION);
227 cachedCursor = cache.getCachedCursor("2", SIMPLE_PROJECTION);
238 token = cache.getCacheToken("3");
239 // Put the cursor in the cache
240 cache.putCursor(cursor1, "3", SIMPLE_PROJECTION, token);
241 // We should never have more than 2 entries in the cache
242 assertEquals(2, cache.size());
244 // The first cursor we added should no longer be in the cache (it's the eldest)
245 cachedCursor = cache.getCachedCursor("1", SIMPLE_PROJECTION);
248 cachedCursor = cache.getCachedCursor("2", SIMPLE_PROJECTION);
251 cachedCursor = cache.getCachedCursor("3", SIMPLE_PROJECTION);
262 // Create a cache of size 2
263 ContentCache cache = new ContentCache("Name", SIMPLE_PROJECTION, 2);
266 Cursor cachedCursor1 = new CachedCursor(underlyingCursor, cache, "1");
267 Cursor cachedCursor2 = new CachedCursor(underlyingCursor, cache, "1");
280 cachedCursor1 = cache.putCursor(
281 underlyingCursor, "2", SIMPLE_PROJECTION, cache.getCacheToken("2"));
282 cachedCursor2 = new CachedCursor(underlyingCursor, cache, "2");
287 // Underlying cursor should still be open; it's in the cache
289 // Cache a new cursor
290 cachedCursor2 = new CachedCursor(underlyingCursor, cache, "2");
292 // Remove "2" from the cache and close the cursor
293 cache.invalidate();
295 // The underlying cursor should now be closed (not in the cache and no cached cursors)