Branch: Tag:

2005-12-05

2005-12-05 08:56:31 by Tobias Liin <liin@roxen.com>

Allowed the fresh-time attribute to be 0. Providing 0 now means no restrictions on data freshness. The standard value for the module setting for this attribute was changed to 0.

Rev: server/modules/tags/insert_cached_href.pike:1.8

37:    LOCALE(0, "States how often the data of an URL should be updated. "    "In seconds, minutes, hours or days."));    -  defvar("fresh-time", "20 minutes", LOCALE(0, "Fresh time"), +  defvar("fresh-time", "0", LOCALE(0, "Fresh time"),    TYPE_STRING|VAR_MORE,    LOCALE(0, "States how long data in the database can be considered fresh enough" -  " to display. In seconds, minutes, hours or days.")); +  " to display. In seconds, minutes, hours or days. As default this" +  " is 0, which means that this attribute is not used and that there" +  " are no restrictions on data freshness."));       defvar("ttl", "7 days", LOCALE(0, "Time to live"),    TYPE_STRING|VAR_MORE,
287:    args["cached-href"]);       result = sql_query("SELECT data FROM " + data_table + " WHERE url='" + -  args["cached-href"] + "' AND " + time() + " - latest_write < " -  + args["fresh-time"]); +  args["cached-href"] + "' AND (" + time() + " - latest_write < " +  + args["fresh-time"] + " OR " + args["fresh-time"] + " = 0)");       if (result && sizeof(result) && result[0]["data"] != "") {    DWRITE("in get_data(): Returning cached data");
464:    db_args["fetch-interval"] = query("fetch-interval");    }    -  if (orig_args["fresh-time"] && valid_arg(orig_args["fresh-time"])) +  if (orig_args["fresh-time"] && +  (valid_arg(orig_args["fresh-time"]) || orig_args["fresh-time"] == "0"))    db_args["fresh-time"] = orig_args["fresh-time"];    else    db_args["fresh-time"] = query("fresh-time");