public final class SoyAstCache extends Object
This allows for file-granularity caching of the parsed tree, to avoid parsing the same file over and over if the contents have not changed. This helps the development experience when there are a large number of files, most of which aren't changing during the edit/reflect loop. This does not help in a production startup-compilation setup; instead, this will just use more memory.
Please treat the internals as Soy superpackage-private.
| Modifier and Type | Class and Description |
|---|---|
static class |
SoyAstCache.VersionedFile
A
SoyFileNode with an associated SoyFileSupplier.Version. |
| Constructor and Description |
|---|
SoyAstCache() |
| Modifier and Type | Method and Description |
|---|---|
SoyAstCache.VersionedFile |
get(String fileName,
SoyFileSupplier.Version version)
Retrieves a cached version of this file supplier AST, if any.
|
IdGenerator |
getNodeIdGenerator()
Returns an ID generator that must be used for all files in this cache.
|
void |
put(String fileName,
SoyAstCache.VersionedFile versionedFile)
Stores a cached version of the AST.
|
public void put(String fileName, SoyAstCache.VersionedFile versionedFile)
Please treat this as superpackage-private for Soy internals.
fileName - The name of the file.versionedFile - The compiled AST at the particular version. The node is defensively
copied; the caller is free to modify it.public SoyAstCache.VersionedFile get(String fileName, SoyFileSupplier.Version version)
Please treat this as superpackage-private for Soy internals.
fileName - The name of the fileversion - The current file version.public IdGenerator getNodeIdGenerator()
If this ID generator is not used, nodes in the cache will have conflicting ID's. It is important to use a manual synchronized block over this cache while using the ID generator since the ID generator is not guaranteed to be thread-safe!
Please treat this as superpackage-private for Soy internals.