Class DefaultUrlConnectionExpiryCalculator
- java.lang.Object
-
- org.mozilla.javascript.commonjs.module.provider.DefaultUrlConnectionExpiryCalculator
-
- All Implemented Interfaces:
java.io.Serializable
,UrlConnectionExpiryCalculator
public class DefaultUrlConnectionExpiryCalculator extends java.lang.Object implements UrlConnectionExpiryCalculator, java.io.Serializable
The default heuristic for calculating cache expiry of URL-based resources. It is simply configured with a default relative expiry, and each invocation ofcalculateExpiry(URLConnection)
returnsSystem.currentTimeMillis()
incremented with the relative expiry.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DefaultUrlConnectionExpiryCalculator()
Creates a new default expiry calculator with one minute relative expiry.DefaultUrlConnectionExpiryCalculator(long relativeExpiry)
Creates a new default expiry calculator with the specified relative expiry.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
calculateExpiry(java.net.URLConnection urlConnection)
Given a URL connection, returns a calculated heuristic expiry time (in terms of milliseconds since epoch) for the resource.
-
-
-
Constructor Detail
-
DefaultUrlConnectionExpiryCalculator
public DefaultUrlConnectionExpiryCalculator()
Creates a new default expiry calculator with one minute relative expiry.
-
DefaultUrlConnectionExpiryCalculator
public DefaultUrlConnectionExpiryCalculator(long relativeExpiry)
Creates a new default expiry calculator with the specified relative expiry.- Parameters:
relativeExpiry
- the fixed relative expiry, in milliseconds.
-
-
Method Detail
-
calculateExpiry
public long calculateExpiry(java.net.URLConnection urlConnection)
Description copied from interface:UrlConnectionExpiryCalculator
Given a URL connection, returns a calculated heuristic expiry time (in terms of milliseconds since epoch) for the resource.- Specified by:
calculateExpiry
in interfaceUrlConnectionExpiryCalculator
- Parameters:
urlConnection
- the URL connection for the resource- Returns:
- the expiry for the resource
-
-