mobile/android/thirdparty/com/squareup/picasso/Cache.java

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mobile/android/thirdparty/com/squareup/picasso/Cache.java	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,64 @@
     1.4 +/*
     1.5 + * Copyright (C) 2013 Square, Inc.
     1.6 + *
     1.7 + * Licensed under the Apache License, Version 2.0 (the "License");
     1.8 + * you may not use this file except in compliance with the License.
     1.9 + * You may obtain a copy of the License at
    1.10 + *
    1.11 + *      http://www.apache.org/licenses/LICENSE-2.0
    1.12 + *
    1.13 + * Unless required by applicable law or agreed to in writing, software
    1.14 + * distributed under the License is distributed on an "AS IS" BASIS,
    1.15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    1.16 + * See the License for the specific language governing permissions and
    1.17 + * limitations under the License.
    1.18 + */
    1.19 +package com.squareup.picasso;
    1.20 +
    1.21 +import android.graphics.Bitmap;
    1.22 +
    1.23 +/**
    1.24 + * A memory cache for storing the most recently used images.
    1.25 + * <p/>
    1.26 + * <em>Note:</em> The {@link Cache} is accessed by multiple threads. You must ensure
    1.27 + * your {@link Cache} implementation is thread safe when {@link Cache#get(String)} or {@link
    1.28 + * Cache#set(String, android.graphics.Bitmap)} is called.
    1.29 + */
    1.30 +public interface Cache {
    1.31 +  /** Retrieve an image for the specified {@code key} or {@code null}. */
    1.32 +  Bitmap get(String key);
    1.33 +
    1.34 +  /** Store an image in the cache for the specified {@code key}. */
    1.35 +  void set(String key, Bitmap bitmap);
    1.36 +
    1.37 +  /** Returns the current size of the cache in bytes. */
    1.38 +  int size();
    1.39 +
    1.40 +  /** Returns the maximum size in bytes that the cache can hold. */
    1.41 +  int maxSize();
    1.42 +
    1.43 +  /** Clears the cache. */
    1.44 +  void clear();
    1.45 +
    1.46 +  /** A cache which does not store any values. */
    1.47 +  Cache NONE = new Cache() {
    1.48 +    @Override public Bitmap get(String key) {
    1.49 +      return null;
    1.50 +    }
    1.51 +
    1.52 +    @Override public void set(String key, Bitmap bitmap) {
    1.53 +      // Ignore.
    1.54 +    }
    1.55 +
    1.56 +    @Override public int size() {
    1.57 +      return 0;
    1.58 +    }
    1.59 +
    1.60 +    @Override public int maxSize() {
    1.61 +      return 0;
    1.62 +    }
    1.63 +
    1.64 +    @Override public void clear() {
    1.65 +    }
    1.66 +  };
    1.67 +}

mercurial