A least recently used cache with a max size, for SimpleDataStructures.
The index to the cache is the first 4 bytes of the data, so
the data must be sufficiently random.
This caches the SDS objects, and also uses SimpleByteCache to cache
the unused byte arrays themselves
Following is sample usage:
private static final SDSCache<Foo> _cache = new SDSCache(Foo.class, LENGTH, 1024);
public static Foo create(byte[] data) {
return _cache.get(data);
}
public static Foo create(byte[] data, int off) {
return _cache.get(data, off);
}
public static Foo create(InputStream in) throws IOException {
return _cache.get(in);
}