@Override public synchronized ResponseMetadata get(Object obj) { // System.identityHashCode isn't guaranteed to be unique // on all platforms, but should be reasonable enough to use // for a few requests at a time. We can always easily move // to our own unique IDs if needed. return internalCache.get(System.identityHashCode(obj)); }
@Override public synchronized void add(Object obj, ResponseMetadata metadata) { if (obj == null) return; internalCache.put(System.identityHashCode(obj), metadata); }
/** * Returns the response metadata associated with the specified object, or * null if no metadata is associated with that object. * * @param obj The key by which the desired metadata is stored. * @return The response metadata associated with the given object key, * otherwise null if no metadata is associated with that object. */ public ResponseMetadata get(Object obj) { // System.identityHashCode isn't guaranteed to be unique // on all platforms, but should be reasonable enough to use // for a few requests at a time. We can always easily move // to our own unique IDs if needed. return internalCache.get(System.identityHashCode(obj)); }
/** * Returns the response metadata associated with the specified object, or * null if no metadata is associated with that object. * * @param obj The key by which the desired metadata is stored. * @return The response metadata associated with the given object key, * otherwise null if no metadata is associated with that object. */ public ResponseMetadata get(Object obj) { // System.identityHashCode isn't guaranteed to be unique // on all platforms, but should be reasonable enough to use // for a few requests at a time. We can always easily move // to our own unique IDs if needed. return internalCache.get(System.identityHashCode(obj)); }
/** * Creates a new cache that will contain, at most the specified number of * entries. * * @param maxEntries * The maximum size of this cache. */ public ResponseMetadataCache(int maxEntries) { internalCache = new InternalCache(maxEntries); }
@Override public synchronized ResponseMetadata get(Object obj) { // System.identityHashCode isn't guaranteed to be unique // on all platforms, but should be reasonable enough to use // for a few requests at a time. We can always easily move // to our own unique IDs if needed. return internalCache.get(System.identityHashCode(obj)); }
@Override public synchronized void add(Object obj, ResponseMetadata metadata) { if (obj == null) return; internalCache.put(System.identityHashCode(obj), metadata); }
@Override protected boolean removeEldestEntry(Entry eldest) { return size() > maxSize; } }
/** * Creates a new cache that will contain, at most the specified number of * entries. * * @param maxEntries The maximum size of this cache. */ public ResponseMetadataCache(int maxEntries) { internalCache = new InternalCache(maxEntries); }
@Override protected boolean removeEldestEntry(Entry eldest) { return size() > maxSize; } }
/** * Creates a new cache that will contain, at most the specified number of * entries. * * @param maxEntries The maximum size of this cache. */ public ResponseMetadataCache(int maxEntries) { internalCache = new InternalCache(maxEntries); }
/** * Adds a new entry to this cache, possibly evicting the oldest entry if the * cache is at its size limit. * * @param obj The key by which to store the metadata. * @param metadata The metadata for this entry. */ public synchronized void add(Object obj, ResponseMetadata metadata) { if (obj == null) return; internalCache.put(System.identityHashCode(obj), metadata); }
@Override protected boolean removeEldestEntry(Entry<Integer,ResponseMetadata> eldest) { return size() > maxSize; } }
/** * Adds a new entry to this cache, possibly evicting the oldest entry if the * cache is at its size limit. * * @param obj The key by which to store the metadata. * @param metadata The metadata for this entry. */ public synchronized void add(Object obj, ResponseMetadata metadata) { if (obj == null) return; internalCache.put(System.identityHashCode(obj), metadata); }
/** * Returns the response metadata associated with the specified object, or * null if no metadata is associated with that object. * * @param obj The key by which the desired metadata is stored. * @return The response metadata associated with the given object key, * otherwise null if no metadata is associated with that object. */ public ResponseMetadata get(Object obj) { // System.identityHashCode isn't guaranteed to be unique // on all platforms, but should be reasonable enough to use // for a few requests at a time. We can always easily move // to our own unique IDs if needed. return internalCache.get(System.identityHashCode(obj)); }
@Override protected boolean removeEldestEntry(Entry eldest) { return size() > maxSize; } }
@Override public synchronized void add(Object obj, ResponseMetadata metadata) { if (obj == null) return; internalCache.put(System.identityHashCode(obj), metadata); }
/** * Creates a new cache that will contain, at most the specified number of * entries. * * @param maxEntries * The maximum size of this cache. */ public ResponseMetadataCache(int maxEntries) { internalCache = new InternalCache(maxEntries); }
/** * Creates a new cache that will contain, at most the specified number of * entries. * * @param maxEntries The maximum size of this cache. */ public ResponseMetadataCache(int maxEntries) { internalCache = new InternalCache(maxEntries); }
@Override protected boolean removeEldestEntry(Entry<Integer,ResponseMetadata> eldest) { return size() > maxSize; } }