Class DefaultUrlConnectionExpiryCalculator

java.lang.Object
org.mozilla.javascript.commonjs.module.provider.DefaultUrlConnectionExpiryCalculator
All Implemented Interfaces:
Serializable, UrlConnectionExpiryCalculator

public class DefaultUrlConnectionExpiryCalculator extends Object implements UrlConnectionExpiryCalculator, Serializable
The default heuristic for calculating cache expiry of URL-based resources. It is simply configured with a default relative expiry, and each invocation of calculateExpiry(URLConnection) returns System.currentTimeMillis() incremented with the relative expiry.
Version:
$Id: DefaultUrlConnectionExpiryCalculator.java,v 1.3 2011/04/07 20:26:12 hannes%helma.at Exp $
Author:
Attila Szegedi
See Also:
  • Constructor Details

    • 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 Details

    • calculateExpiry

      public long calculateExpiry(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 interface UrlConnectionExpiryCalculator
      Parameters:
      urlConnection - the URL connection for the resource
      Returns:
      the expiry for the resource