/** * Remove an existing mapping from the cache. * * @param parentPathId The parent's path (directory) ID number. * @param childPathName The name of the path within the parent's directory */ public void remove(int parentPathId, String childPathName) { PathNameCacheKey key = new PathNameCacheKey(parentPathId, childPathName); map.remove(key); }
/** * Given a parent Path ID number and the child's path name look up the value in the cache. * * @param parentPathId The parent's path (directory) ID number. * @param childPathName The name of the path within the parent's directory * @return a PathNameCacheValue object containing the cache mapping, or null if the mapping isn't * in the cache. */ public PathNameCacheValue get(int parentPathId, String childPathName) { PathNameCacheKey key = new PathNameCacheKey(parentPathId, childPathName); return map.get(key); }
/** * Add a new mapping to the cache. * * @param parentPathId The parent's path ID (actually, a directory ID). * @param childPathName The name of the path within that parent's directory. * @param childPathId The child's path ID to be used as the target of the mapping. * @param childType What type is the child (file, directory, etc), to be used as the target of the * mapping. */ public void put(int parentPathId, String childPathName, int childPathId, int childType) { PathNameCacheKey key = new PathNameCacheKey(parentPathId, childPathName); PathNameCacheValue value = new PathNameCacheValue(childPathId, childType); map.put(key, value); }
/** Clear the cache, removing all stored items and reseting the size to 0. */ public void clear() { map.clear(); }