@Override public CacheReference key(final T object) { return proxy.key(object); }
@Override public CacheReference key(final Path object) { return delegate.key(object); }
@Override public AttributedList<T> put(final T reference, final AttributedList<T> children) { for(T f : children) { final CacheReference key = proxy.key(f); reverse.remove(key); reverse.put(key, reference); } return proxy.put(reference, children); }
public AttributedList<T> remove(final T reference) { final AttributedList<T> removed = proxy.remove(reference); for(T r : removed) { reverse.remove(proxy.key(r)); } return removed; }
/** * Lookup a path by reference in the cache. * * @param reference A child object of a cached directory listing in the cache * @return Null if the path is not in the cache * @see ch.cyberduck.core.AttributedList#get(Referenceable) */ public T lookup(final CacheReference reference) { final T parent = reverse.get(reference); final AttributedList<T> list = proxy.get(parent); if(list.isEmpty()) { log.warn(String.format("Lookup failed for %s in reverse cache", reference)); return null; } final T[] entries = list.toArray(); for(T entry : entries) { if(proxy.key(entry).equals(reference)) { return entry; } } log.warn(String.format("Lookup failed for %s in reverse cache", reference)); return null; }