com.google.clearsilver.jsilver.adaptor
Class LoadPathToFileCache

java.lang.Object
  extended by com.google.clearsilver.jsilver.adaptor.LoadPathToFileCache

public class LoadPathToFileCache
extends Object

This class implements a cache of a list of loadpaths and a file name to the absolute file name where the file is located on the filesystem. The purpose is to avoid filesystem calls for common operations, like in which of these directories does this file exist? This class is threadsafe. Some of this code is copied from com.google.clearsilver.base.CSFileCache.


Constructor Summary
LoadPathToFileCache(int capacity)
           
 
Method Summary
 void add(List<String> loadPaths, String filename, String filePath)
          Add a new mapping to the cache.
 String lookup(List<String> loadPaths, String filename)
          Lookup in the cache to see if we have a mapping from the given loadpaths and filename to an absolute file path.
static String makeCacheKey(List<String> loadPaths, String filename)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoadPathToFileCache

public LoadPathToFileCache(int capacity)
Method Detail

lookup

public String lookup(List<String> loadPaths,
                     String filename)
Lookup in the cache to see if we have a mapping from the given loadpaths and filename to an absolute file path.

Parameters:
loadPaths - the ordered list of directories to search for the file.
filename - the name of the file.
Returns:
the absolute filepath location of the file, or null if not in the cache.

add

public void add(List<String> loadPaths,
                String filename,
                String filePath)
Add a new mapping to the cache.

Parameters:
loadPaths - the ordered list of directories to search for the file.
filename - the name of the file.
filePath - the absolute filepath location of the file

makeCacheKey

public static String makeCacheKey(List<String> loadPaths,
                                  String filename)


Copyright © 2010-2012 Google. All Rights Reserved.