A Cache Manager for the Asset-Pipeline runtime. This reduces repeat processing of files that have already been processed during the runtime of the asset-pipeline. It also is capable of persisting this cache as an ObjectStream to the '.asscache' file Private API Class
Type | Name and description |
---|---|
static Integer |
CACHE_DEBOUNCE_MS |
static String |
CACHE_LOCATION |
static Object |
LOCK_FETCH_OBJECT |
static Object |
LOCK_OBJECT |
static Map<String, Map<String, Object>> |
cache |
static CachePersister |
cachePersister |
static String |
configCacheBustDigest |
Type | Name and description |
---|---|
static void |
addCacheDependency(String fileName, AssetFile dependentFile) Called during asset processing to add a dependent file to another file cache. |
static void |
asyncCacheSave() Asynchronously starts a thread used to persist the cache to disk It also performs a debounce behavior so rapid calls to the save do not cause repeat saves |
static void |
createCache(String fileName, String md5Hash, String processedFileText, String originalFileName = null) Creates a cache entry for a file. |
static String |
findCache(String fileName, String md5, String originalFileName = null) Returns the cache string value of a file if it exists in the cache and is unmodified since last checked |
static void |
loadPersistedCache() Loads an Asset Cache dependency graph for asset-pipeline. |
static void |
save() Called by the async CachePersister class to save the cache map to disk |
Called during asset processing to add a dependent file to another file cache. This allows for cache busting on things like imported less files or sass files.
fileName
- The name of the file we are adding a dependency todependentFile
- the AssetFile object we are adding as a dependencyAsynchronously starts a thread used to persist the cache to disk It also performs a debounce behavior so rapid calls to the save do not cause repeat saves
Creates a cache entry for a file. This includes a name, md5Hash and processed file text
fileName
- The file name of the file to be cached (cache key)md5Hash
- The current md5 hash of the fileprocessedFileText
- The processed text of the file being cachedoriginalFileName
- The original file name of the base file being persistedReturns the cache string value of a file if it exists in the cache and is unmodified since last checked
fileName
- The name of the file also known as the cache keymd5
- The current md5 digest of the file. This is compared against the original fileoriginalFileName
- - Original file name of the file. This is for cache busting bundled assetsLoads an Asset Cache dependency graph for asset-pipeline. This is currently encoded in JSON If the asset cache file does not exist or a cache is already loaded, the cache store is not parsed.
Called by the async CachePersister class to save the cache map to disk