public class TTLTemplateResolutionValidity extends Object implements ITemplateResolutionValidity
Simple implementation of ITemplateResolutionValidity
that uses a TTL (time-to-live) expressed in milliseconds to
compute the validity of template cache entries.
Constructor and Description |
---|
TTLTemplateResolutionValidity(long cacheTTLMs)
Creates a new instance of this validity implementation.
|
Modifier and Type | Method and Description |
---|---|
long |
getCacheTTLMs()
Returns the TTL in milliseconds to be applied to template
validity.
|
boolean |
isCacheable()
Returns true.
|
boolean |
isCacheStillValid()
Returns whether the template resolution can still be considered valid.
|
public TTLTemplateResolutionValidity(long cacheTTLMs)
Creates a new instance of this validity implementation.
cacheTTLMs
- the TTL to be applied to the template resolution.public long getCacheTTLMs()
Returns the TTL in milliseconds to be applied to template validity.
public boolean isCacheable()
Returns true. Templates are always considered cacheable using this validity implementation.
isCacheable
in interface ITemplateResolutionValidity
public boolean isCacheStillValid()
Returns whether the template resolution can still be considered valid. This is done by computing the difference in milliseconds between the moment when this object was created and the moment this method is called, and checking it is less than the established TTL (time-to-live).
isCacheStillValid
in interface ITemplateResolutionValidity
Copyright © 2017 The THYMELEAF team. All rights reserved.