ModelCache (FreeMarker 2.3.35 API)
Description: declaration: package: freemarker.ext.util, class: ModelCache

Package freemarker.ext.util

# Class ModelCache

java.lang.Object
freemarker.ext.util.ModelCache

Direct Known Subclasses:
  `BeansModelCache`

public abstract class ModelCache extends Object
Internally used by various wrapper implementations to implement model caching.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `ModelCache()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clearCache()`
  `protected abstract TemplateModel`
  `create​(Object object)`
  `TemplateModel`
  `getInstance​(Object object)`
  `boolean`
  `getUseCache()`
  `protected abstract boolean`
  `isCacheable​(Object object)`
  `void`
  `setUseCache​(boolean useCache)`
  Sets whether this wrapper caches model instances.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ModelCache

    protected ModelCache()

- ## Method Details

  - ### setUseCache

    public void setUseCache​(boolean useCache)
    Sets whether this wrapper caches model instances. Default is false. When set to true, calling `getInstance(Object)` multiple times for the same object will return the same model.

  - ### getUseCache

    public boolean getUseCache()
    Since:
      2.3.21

  - ### getInstance

    public TemplateModel getInstance​(Object object)

  - ### create

    protected abstract TemplateModel create​(Object object)

  - ### isCacheable

    protected abstract boolean isCacheable​(Object object)

  - ### clearCache

    public void clearCache()