org.openjena.atlas.lib
Interface Cache<Key,Value>

All Known Subinterfaces:
CacheStats<K,V>
All Known Implementing Classes:
Cache0, Cache1, CacheLRU, CacheSimple, CacheStatsAtomic, CacheStatsSimple, CacheSync, CacheUnbounded, CacheWithGetter, CacheWrapper

public interface Cache<Key,Value>

A cache


Method Summary
 void clear()
           
 boolean containsKey(Key key)
          Does the cache contain the key?
 Value get(Key key)
          Get from cache - or return null.
 boolean isEmpty()
           
 Iterator<Key> keys()
          Iterate over all keys.
 Value put(Key key, Value thing)
          Insert into from cache and return old value (or null if none)
 boolean remove(Key key)
          Remove from cache - return true if key referenced an entry
 void setDropHandler(ActionKeyValue<Key,Value> dropHandler)
          Register a callback - called when an object is dropped from the cache (optional operation)
 long size()
          Current size of cache
 

Method Detail

containsKey

boolean containsKey(Key key)
Does the cache contain the key?


get

Value get(Key key)
Get from cache - or return null. Implementations should state whether they are thread-safe or not.


put

Value put(Key key,
          Value thing)
Insert into from cache and return old value (or null if none)


remove

boolean remove(Key key)
Remove from cache - return true if key referenced an entry


keys

Iterator<Key> keys()
Iterate over all keys. Iteratering over the keys requires the caller be thread-safe.


isEmpty

boolean isEmpty()

clear

void clear()

size

long size()
Current size of cache


setDropHandler

void setDropHandler(ActionKeyValue<Key,Value> dropHandler)
Register a callback - called when an object is dropped from the cache (optional operation)



Licenced under the Apache License, Version 2.0