PooledCache.java revision 93a35b93dc582e38ff8ee5979754a16b4bf4da0c
1/* 2 * Copyright (C) 2013 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package com.android.bitmap; 18 19public interface PooledCache<K, V> { 20 21 V get(K key, boolean incrementRefCount); 22 V put(K key, V value); 23 void offer(V scrapValue); 24 V poll(); 25 String toDebugString(); 26 27 /** 28 * Purge existing Poolables from the pool+cache. Usually, this is done when situations 29 * change and the items in the pool+cache are no longer appropriate. For example, 30 * if the layout changes, the pool+cache may need to hold larger bitmaps. 31 * 32 * <p/> 33 * The existing Poolables will be garbage collected when they are no longer being referenced 34 * by other objects. 35 */ 36 void clear(); 37} 38