Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/Id... #12

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -21,19 +21,32 @@
import org.apache.jackrabbit.spi.ItemId;

import java.util.Map;
import java.util.HashMap;
import java.util.LinkedHashMap;

/**
* <code>IdURICache</code>...
*/
class IdURICache {

private final static int CACHESIZE = 10000;

private static Logger log = LoggerFactory.getLogger(IdURICache.class);

private final String workspaceUri;

private Map<ItemId, String> idToUriCache = new HashMap<ItemId, String>();
private Map<String, ItemId> uriToIdCache = new HashMap<String, ItemId>();
private Map<ItemId, String> idToUriCache = new LinkedHashMap<ItemId, String>(CACHESIZE, 1) {

@Override
protected boolean removeEldestEntry(Map.Entry<ItemId, String> eldest) {
return this.size() > CACHESIZE;
}
};
private Map<String, ItemId> uriToIdCache = new LinkedHashMap<String, ItemId>(CACHESIZE, 1) {

@Override
protected boolean removeEldestEntry(Map.Entry<String, ItemId> eldest) {
return this.size() > CACHESIZE;
}
};

IdURICache(String workspaceUri) {
this.workspaceUri = workspaceUri;
Expand Down