public 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.
| Constructor and Description |
|---|
SoyAstCache() |
| Modifier and Type | Method and Description |
|---|---|
Pair<SoyFileNode,SoyFileSupplier.Version> |
get(SoyFileSupplier supplier)
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(SoyFileSupplier supplier,
SoyFileSupplier.Version version,
SoyFileNode node)
Stores a cached version of the AST.
|
public void put(SoyFileSupplier supplier, SoyFileSupplier.Version version, SoyFileNode node)
Please treat this as superpackage-private for Soy internals.
supplier - The supplier for the particular file to cache.version - The version of the supplier when it was read.soyFileNode - The compiled AST at the particular version. The node is defensively copied;
the caller is free to modify it.public Pair<SoyFileNode,SoyFileSupplier.Version> get(SoyFileSupplier supplier)
Please treat this as superpackage-private for Soy internals.
supplier - The supplier for the particular file to cache.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.