GNU logs - #49033, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#49033: 28.0.50; [PATCH] Feature suggestion, url-cache-expiry-alist to override expire time for cache pruning
Resent-From: Alex Bochannek <alex@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 15 Jun 2021 05:41:01 +0000
Resent-Message-ID: <handler.49033.B.162373564623696 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 49033
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: 49033 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.162373564623696
          (code B ref -1); Tue, 15 Jun 2021 05:41:01 +0000
Received: (at submit) by debbugs.gnu.org; 15 Jun 2021 05:40:46 +0000
Received: from localhost ([127.0.0.1]:48266 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lt1ob-0006A8-Vj
	for submit <at> debbugs.gnu.org; Tue, 15 Jun 2021 01:40:46 -0400
Received: from lists.gnu.org ([209.51.188.17]:56600)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <alex@HIDDEN>) id 1lt1oa-0006A0-9K
 for submit <at> debbugs.gnu.org; Tue, 15 Jun 2021 01:40:44 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:41388)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <alex@HIDDEN>)
 id 1lt1oa-0001Ib-0u
 for bug-gnu-emacs@HIDDEN; Tue, 15 Jun 2021 01:40:44 -0400
Received: from ns.lapseofthought.com ([50.0.39.240]:41118
 helo=mail.lapseofthought.com)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <alex@HIDDEN>)
 id 1lt1oV-0005k9-O6
 for bug-gnu-emacs@HIDDEN; Tue, 15 Jun 2021 01:40:43 -0400
Received: from awb-mbp.local (unknown
 [IPv6:2601:646:4200:b470:ecdd:e5a6:220a:9156])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by mail.lapseofthought.com (Postfix) with ESMTPSA id 4G3xxB0SyNz3pdqB
 for <bug-gnu-emacs@HIDDEN>; Mon, 14 Jun 2021 22:40:30 -0700 (PDT)
From: Alex Bochannek <alex@HIDDEN>
Date: Mon, 14 Jun 2021 22:40:29 -0700
Message-ID: <m2pmwnado2.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Authentication-Results: ORIGINATING;
 auth=pass smtp.auth=alex smtp.mailfrom=alex@HIDDEN
Received-SPF: pass client-ip=50.0.39.240; envelope-from=alex@HIDDEN;
 helo=mail.lapseofthought.com
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--=-=-=
Content-Type: text/plain

Hello!

I was looking at the Gravatar code and noticed Larsi's change last year
to disable the URL caching and instead use a hash table. I would like to
see the timeout for the hash table configurable again and this sent me
to the `url-cache-expired' and `url-cache-prune-cache' functions. It
appears that `url-cache-expired' is no longer used after the Gravatar
caching change, so I was wondering if maybe it could be useful to have a
more general, URL-specific expiry policy in the URL caching code. This
way, on-disk caching for, e.g., gravatar.com could be longer than for
the in-memory hash - right now expiry for the Gravatar memory cache is
12 hours, for the global disk cache it is 1 hour.

I wrote up the below and I am asking for feedback on it. I was
particularly concerned about back-forming the URL based on the cache
path and there really should be some test cases around that. I have done
minimal testing and I am open to suggestions to do this differently.

--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline

diff --git a/lisp/url/url-cache.el b/lisp/url/url-cache.el
index 830e6ba9dc..1bf5abcb51 100644
--- a/lisp/url/url-cache.el
+++ b/lisp/url/url-cache.el
@@ -38,6 +38,12 @@ url-cache-expire-time
   :type 'integer
   :group 'url-cache)
 
+(defcustom url-cache-expiry-alist nil
+  "Alist of URL regular expressions to override the `url-cache-expire-time'."
+  :version "28.1"
+  :type 'alist
+  :group 'url-cache)
+
 ;; Cache manager
 (defun url-cache-file-writable-p (file)
   "Follows the documentation of `file-writable-p', unlike `file-writable-p'."
@@ -186,6 +192,27 @@ url-cache-create-filename
             (if (url-p url) url
               (url-generic-parse-url url)))))
 
+(defun url-cache-create-url-from-file (file)
+  (if (file-exists-p file)
+      (let* ((url-path-list
+	     (split-string
+	      (string-trim-right
+	       (string-trim-left
+		file
+		(concat "^.*/" (user-real-login-name)))
+	       "/[^/]+$") "/" t))
+	     (url-access-method
+	      (pop url-path-list))
+	     (url-domain-name
+	      (string-join
+	       (reverse url-path-list)
+	       "."))
+	     (url
+	      (string-join
+	       (list url-access-method url-domain-name)
+	       "://")))
+	url)))
+
 ;;;###autoload
 (defun url-cache-extract (fnam)
   "Extract FNAM from the local disk cache."
@@ -226,7 +253,22 @@ url-cache-prune-cache
 	   ((time-less-p
 	     (time-add
 	      (file-attribute-modification-time (file-attributes file))
-	      url-cache-expire-time)
+	      (or
+		(let ((expire-time
+		       (remove
+			nil
+			(mapcar
+			 (lambda (alist)
+			   (let ((key (car alist))
+				(value (cdr alist)))
+			     (if
+				 (string-match
+				  key
+				  (url-cache-create-url-from-file file))
+				  value)))
+			url-cache-expiry-alist))))
+		 (if (consp expire-time) (apply 'min expire-time) nil))
+	       url-cache-expire-time))
 	     now)
 	    (delete-file file)
 	    (setq deleted-files (1+ deleted-files))))))


--=-=-=
Content-Type: text/plain

I also didn't really like the way the code ended up being formatted. Is
there some guidance around splitting functions and their arguments
across multiple lines?

For the Gravatar change, I had this in mind.

--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline

diff --git a/lisp/image/gravatar.el b/lisp/image/gravatar.el
index f6f056a2ba..6fea19d942 100644
--- a/lisp/image/gravatar.el
+++ b/lisp/image/gravatar.el
@@ -41,15 +41,14 @@ gravatar-automatic-caching
   :group 'gravatar)
 (make-obsolete-variable 'gravatar-automatic-caching nil "28.1")
 
-(defcustom gravatar-cache-ttl 2592000
+(defcustom gravatar-cache-ttl 43200
   "Time to live in seconds for gravatar cache entries.
 If a requested gravatar has been cached for longer than this, it
-is retrieved anew.  The default value is 30 days."
+is retrieved anew.  The default value is 12 hours."
   :type 'integer
   ;; Restricted :type to number of seconds.
   :version "27.1"
   :group 'gravatar)
-(make-obsolete-variable 'gravatar-cache-ttl nil "28.1")
 
 (defcustom gravatar-rating "g"
   "Most explicit Gravatar rating level to allow.
@@ -287,8 +286,7 @@ gravatar-retrieve
 (defun gravatar--prune-cache ()
   (let ((expired nil)
         (time (- (time-convert (current-time) 'integer)
-                 ;; Twelve hours.
-                 (* 12 60 60))))
+                 gravatar-cache-ttl)))
     (maphash (lambda (key val)
                (when (< (car val) time)
                  (push key expired)))

--=-=-=
Content-Type: text/plain

Thanks!

-- 
Alex.

--=-=-=--




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Alex Bochannek <alex@HIDDEN>
Subject: bug#49033: Acknowledgement (28.0.50; [PATCH] Feature suggestion,
 url-cache-expiry-alist to override expire time for cache pruning)
Message-ID: <handler.49033.B.162373564623696.ack <at> debbugs.gnu.org>
References: <m2pmwnado2.fsf@HIDDEN>
X-Gnu-PR-Message: ack 49033
X-Gnu-PR-Package: emacs
X-Gnu-PR-Keywords: patch
Reply-To: 49033 <at> debbugs.gnu.org
Date: Tue, 15 Jun 2021 05:41:01 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 49033 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
49033: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D49033
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#49033: 28.0.50; [PATCH] Feature suggestion, url-cache-expiry-alist to override expire time for cache pruning
Resent-From: Lars Ingebrigtsen <larsi@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 15 Jun 2021 14:12:01 +0000
Resent-Message-ID: <handler.49033.B49033.162376629519821 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 49033
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Alex Bochannek <alex@HIDDEN>
Cc: 49033 <at> debbugs.gnu.org
Received: via spool by 49033-submit <at> debbugs.gnu.org id=B49033.162376629519821
          (code B ref 49033); Tue, 15 Jun 2021 14:12:01 +0000
Received: (at 49033) by debbugs.gnu.org; 15 Jun 2021 14:11:35 +0000
Received: from localhost ([127.0.0.1]:50364 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lt9mx-00059c-JD
	for submit <at> debbugs.gnu.org; Tue, 15 Jun 2021 10:11:35 -0400
Received: from quimby.gnus.org ([95.216.78.240]:50580)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1lt9mw-00059N-47
 for 49033 <at> debbugs.gnu.org; Tue, 15 Jun 2021 10:11:34 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=5S1piCKEZKsEpq3Yf6CR6V7r9LDCff7kxFWPjIIADas=; b=Xe29dTRf6CKHWt94JeChpSH1MV
 L6s2D+Dlbk/aJeRjHkdpgRfJtrFzfOl3sQzoCDKPr5VDmDKURuvGKJ0xMxa215blNxntDP/590bCr
 Ka18PrNxS7zhiQAA9xejD+Cbt9SirIfzEeFp1B6oOPuJtpGRRKFMQA6K/o2QRZvvwI+k=;
Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1lt9mm-0007b8-JO; Tue, 15 Jun 2021 16:11:27 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
References: <m2pmwnado2.fsf@HIDDEN>
X-Now-Playing: Bobbi Humphrey's _Blacks and Blues_: "Harlem River Drive"
Date: Tue, 15 Jun 2021 16:11:23 +0200
In-Reply-To: <m2pmwnado2.fsf@HIDDEN> (Alex Bochannek's message of "Mon, 
 14 Jun 2021 22:40:29 -0700")
Message-ID: <87r1h3tdys.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Alex Bochannek <alex@HIDDEN> writes: > +(defcustom
 url-cache-expiry-alist nil > + "Alist of URL regular expressions to override
 the `url-cache-expire-time'." > + :version "28.1" > + :type 'alist > + :group
 'url-cache) 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Alex Bochannek <alex@HIDDEN> writes:

> +(defcustom url-cache-expiry-alist nil
> +  "Alist of URL regular expressions to override the `url-cache-expire-time'."
> +  :version "28.1"
> +  :type 'alist
> +  :group 'url-cache)

Sure, adding this makes sense to me.

> +(defun url-cache-create-url-from-file (file)

I thought this existed, but I guess not...  

> +		(let ((expire-time
> +		       (remove
> +			nil
> +			(mapcar
> +			 (lambda (alist)
> +			   (let ((key (car alist))
> +				(value (cdr alist)))
> +			     (if
> +				 (string-match
> +				  key
> +				  (url-cache-create-url-from-file file))
> +				  value)))
> +			url-cache-expiry-alist))))
> +		 (if (consp expire-time) (apply 'min expire-time) nil))
> +	       url-cache-expire-time))
>  	     now)
>  	    (delete-file file)
>  	    (setq deleted-files (1+ deleted-files))))))
>
> I also didn't really like the way the code ended up being formatted. Is
> there some guidance around splitting functions and their arguments
> across multiple lines?

Well, we never do:

> +			     (if
> +				 (string-match

But in general, we just try to keep it readable, which means not going
too far in either horizontal nor vertical directions.  (So there's
really no rules for formatting beyond that.)  Your code in this patch
generally seems to be way too vertical.

> -                 ;; Twelve hours.
> -                 (* 12 60 60))))
> +                 gravatar-cache-ttl)))

I don't mind that -- but is this really something that somebody would
want to control?  It just seemed unlikely to me.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#49033: 28.0.50; [PATCH] Feature suggestion, url-cache-expiry-alist to override expire time for cache pruning
Resent-From: Alex Bochannek <alex@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 15 Jun 2021 22:57:01 +0000
Resent-Message-ID: <handler.49033.B49033.162379776323802 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 49033
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Lars Ingebrigtsen <larsi@HIDDEN>
Cc: 49033 <at> debbugs.gnu.org
Received: via spool by 49033-submit <at> debbugs.gnu.org id=B49033.162379776323802
          (code B ref 49033); Tue, 15 Jun 2021 22:57:01 +0000
Received: (at 49033) by debbugs.gnu.org; 15 Jun 2021 22:56:03 +0000
Received: from localhost ([127.0.0.1]:51023 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ltHyU-0006Bq-Oq
	for submit <at> debbugs.gnu.org; Tue, 15 Jun 2021 18:56:03 -0400
Received: from ns.lapseofthought.com ([50.0.39.240]:56169
 helo=mail.lapseofthought.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <alex@HIDDEN>) id 1ltHyQ-0006BO-EW
 for 49033 <at> debbugs.gnu.org; Tue, 15 Jun 2021 18:56:01 -0400
Received: from awb-mbp.local (unknown
 [IPv6:2601:646:4200:b470:489a:eae4:d7dc:db39])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by mail.lapseofthought.com (Postfix) with ESMTPSA id 4G4Nvv3gdfz3pdqP;
 Tue, 15 Jun 2021 15:55:55 -0700 (PDT)
From: Alex Bochannek <alex@HIDDEN>
References: <m2pmwnado2.fsf@HIDDEN> <87r1h3tdys.fsf@HIDDEN>
Date: Tue, 15 Jun 2021 15:55:54 -0700
In-Reply-To: <87r1h3tdys.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Tue,
 15 Jun 2021 16:11:23 +0200")
Message-ID: <m2czsmagat.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Authentication-Results: ORIGINATING;
 auth=pass smtp.auth=alex smtp.mailfrom=alex@HIDDEN
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

Lars Ingebrigtsen <larsi@HIDDEN> writes:

>> -                 ;; Twelve hours.
>> -                 (* 12 60 60))))
>> +                 gravatar-cache-ttl)))
>
> I don't mind that -- but is this really something that somebody would
> want to control?  It just seemed unlikely to me.

I tend to find it difficult to reason about functionality if constants
like this are in the code and not in variables. It may be unlikely that
many people will want to customize it, but I'd rather expose this as a
configuration variable than hide a static value in the code.


As far as the URL caching code is concerned, I cleaned it up a bit and
added some simple tests and documentation.

Support URL-specific cache expiration

	* test/lisp/url/url-cache-tests.el: Test URL-to-filename and
	filename-to-URL mappings used by URL caching.

	* lisp/url/url-cache.el (url-cache-expiry-alist)
	(url-cache-create-url-from-file, url-cache-expired)
	(url-cache-prune-cache): Expire cache entries based on regular
	expressions matching URLs defined in new customizable variable
	url-cache-expire-alist.

	* doc/misc/url.texi (Disk Caching): Mention
	url-cache-expiry-alist variable.

--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline

diff --git a/doc/misc/url.texi b/doc/misc/url.texi
index 8f15e11007..2ea34e0d03 100644
--- a/doc/misc/url.texi
+++ b/doc/misc/url.texi
@@ -923,6 +923,12 @@ Disk Caching
 expire-time argument of the function @code{url-cache-expired}.
 @end defopt
 
+@defopt url-cache-expiry-alist
+This variable is an alist of regular expressions matching @var{url}'s
+and their associated expiration delay in seconds.  It is used by the
+functions @code{url-cache-expired} and @code{url-cache-prune-cache}.
+@end defopt
+
 @defun url-fetch-from-cache
 This function takes a URL as its argument and returns a buffer
 containing the data cached for that URL.
diff --git a/lisp/url/url-cache.el b/lisp/url/url-cache.el
index 830e6ba9dc..48f315a5cc 100644
--- a/lisp/url/url-cache.el
+++ b/lisp/url/url-cache.el
@@ -38,6 +38,15 @@ url-cache-expire-time
   :type 'integer
   :group 'url-cache)
 
+(defcustom url-cache-expiry-alist nil
+  "Alist of URL regular expressions to override the `url-cache-expire-time'.
+The key is a string to be matched against the URL of the cached entry and the
+value is the expire time in seconds.  Only the protocol and hostname of the URL
+are available for matching."
+  :version "28.1"
+  :type 'alist
+  :group 'url-cache)
+
 ;; Cache manager
 (defun url-cache-file-writable-p (file)
   "Follows the documentation of `file-writable-p', unlike `file-writable-p'."
@@ -186,6 +195,31 @@ url-cache-create-filename
             (if (url-p url) url
               (url-generic-parse-url url)))))
 
+(defun url-cache-create-url-from-file (file)
+  (let* ((url-path-list
+	  (split-string
+	   (file-name-directory
+	    (string-trim-left file (concat "^.*/" (user-real-login-name))))
+	    "/" t))
+	 (protocol (pop url-path-list))
+	 (hostname
+	  (string-join (reverse url-path-list) "."))
+	 (url (string-join (list protocol hostname) "://")))
+    url))
+
+(defun url-cache-expiry-by-url (url)
+  (let ((expire-time
+	 (remove nil
+		 (mapcar
+		  (lambda (alist)
+		    (let ((key (car alist))
+			  (value (cdr alist)))
+		      (if (string-match
+			   key url)
+			  value)))
+		  url-cache-expiry-alist))))
+    (if (consp expire-time) (apply 'min expire-time) nil)))
+
 ;;;###autoload
 (defun url-cache-extract (fnam)
   "Extract FNAM from the local disk cache."
@@ -204,7 +238,9 @@ url-cache-expired
 	  (time-less-p
 	   (time-add
 	    cache-time
-	    (or expire-time url-cache-expire-time))
+	    (or expire-time
+		(url-cache-expiry-by-url url)
+		url-cache-expire-time))
 	   nil)))))
 
 (defun url-cache-prune-cache (&optional directory)
@@ -226,8 +262,10 @@ url-cache-prune-cache
 	   ((time-less-p
 	     (time-add
 	      (file-attribute-modification-time (file-attributes file))
-	      url-cache-expire-time)
-	     now)
+	      (or (url-cache-expiry-by-url
+		   (url-cache-create-url-from-file file))
+		  url-cache-expire-time))
+	      now)
 	    (delete-file file)
 	    (setq deleted-files (1+ deleted-files))))))
       (if (< deleted-files total-files)
diff --git a/test/lisp/url/url-cache-tests.el b/test/lisp/url/url-cache-tests.el
new file mode 100644
index 0000000000..f4e49ce3b9
--- /dev/null
+++ b/test/lisp/url/url-cache-tests.el
@@ -0,0 +1,76 @@
+;;; url-cache-tests.el --- Test suite for url-cache.  -*- lexical-binding:t -*-
+
+;; Copyright (C) 2021 Free Software Foundation, Inc.
+
+;; Author: Alex Bochannek <alex@HIDDEN>
+;; Keywords: data
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'ert)
+(require 'url-cache)
+
+(ert-deftest url-cache-url-to-filename-tests ()
+  "Test the URL to filename resolution for the URL cache"
+  (should (equal (file-name-directory
+		  (url-cache-create-filename "http://www.fsf.co.uk"))
+		 (string-join
+		  (list url-cache-directory (user-real-login-name)
+			"http/uk/co/fsf/www/") "/")))
+  (should (equal (file-name-directory
+		  (url-cache-create-filename "https://www.fsf.co.uk"))
+		 (string-join
+		  (list url-cache-directory (user-real-login-name)
+			"https/uk/co/fsf/www/") "/")))
+  (should (equal (file-name-directory
+		  (url-cache-create-filename "http://host"))
+		 (string-join
+		  (list url-cache-directory (user-real-login-name)
+			"http/host/") "/")))
+  (should (equal (file-name-directory
+		  (url-cache-create-filename "http://host:80"))
+		 (string-join
+		  (list url-cache-directory (user-real-login-name)
+			"http/host/") "/")))
+  (should (equal (file-name-directory
+		  (url-cache-create-filename "http://host#fragment"))
+		 (string-join
+		  (list url-cache-directory (user-real-login-name)
+			"http/host/") "/"))))
+
+(ert-deftest url-cache-filename-to-url-tests ()
+  "Test the filename to URL resolution for the URL cache"
+  (should (equal (url-cache-create-url-from-file
+		  (string-join
+		   (list url-cache-directory (user-real-login-name)
+			 "http/uk/co/fsf/www/") "/"))
+		 "http://www.fsf.co.uk"))
+  (should (equal (url-cache-create-url-from-file
+		  (string-join
+		   (list url-cache-directory (user-real-login-name)
+			 "https/uk/co/fsf/www/") "/"))
+		 "https://www.fsf.co.uk"))
+  (should (equal (url-cache-create-url-from-file
+		  (string-join
+		   (list url-cache-directory (user-real-login-name)
+			 "http/host/") "/"))
+		 "http://host")))
+
+(provide 'url-cache-tests)
+
+;;; url-cache-tests.el ends here

--=-=-=
Content-Type: text/plain

-- 
Alex.

--=-=-=--




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#49033: 28.0.50; [PATCH] Feature suggestion, url-cache-expiry-alist to override expire time for cache pruning
Resent-From: Lars Ingebrigtsen <larsi@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sat, 19 Jun 2021 12:15:01 +0000
Resent-Message-ID: <handler.49033.B49033.162410489826269 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 49033
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Alex Bochannek <alex@HIDDEN>
Cc: 49033 <at> debbugs.gnu.org
Received: via spool by 49033-submit <at> debbugs.gnu.org id=B49033.162410489826269
          (code B ref 49033); Sat, 19 Jun 2021 12:15:01 +0000
Received: (at 49033) by debbugs.gnu.org; 19 Jun 2021 12:14:58 +0000
Received: from localhost ([127.0.0.1]:58700 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1luZsI-0006pd-0O
	for submit <at> debbugs.gnu.org; Sat, 19 Jun 2021 08:14:58 -0400
Received: from quimby.gnus.org ([95.216.78.240]:50720)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1luZsG-0006pO-MF
 for 49033 <at> debbugs.gnu.org; Sat, 19 Jun 2021 08:14:57 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=rSe+wbBgJqUDzr+ymUA1DxvHwCSMl5alXIXc4AfnspI=; b=XyEYGj6tSXG9t9MocNhdwP2Pgs
 aLbjIe02MkIDpKbX9aVkS0rPe0jvOFhPTRVDbhoIM366c7B/AGPiNEG3EkNqxOYBK4qRsCAXfbdvc
 VeogHtUq/REsYgNkMZbsmMUFzhUK5X2bO7Qf+UjcO3o+mrJINnc6Ng8TzbxVPki3O6MA=;
Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=elva)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1luZs8-0001jB-6h; Sat, 19 Jun 2021 14:14:50 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
References: <m2pmwnado2.fsf@HIDDEN> <87r1h3tdys.fsf@HIDDEN>
 <m2czsmagat.fsf@HIDDEN>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAElBMVEX6+/i0tq51eoI5
 P1tNUmT////HiKSZAAAAAWJLR0QF+G/pxwAAAAd0SU1FB+UGEws3KgBYq0MAAAF+SURBVDjLzZJR
 lqwgDETB6QVA6wK0YQEPkwUoyf7XNAngCL4z/8NHt4drpSoxxvx3nPmTx3rfHj6/vDHTqn9v5u0B
 OMlvBGY+B8AcnVkwC2A3AjYWs4lPSeBsXrxKyYdkxiTwEChn7XNHZ/ECo71YSLJSKo9gQmaPCvgB
 Mse4xdHdHuIiNx+3jCCypRxzxC0oOO42cjjVIzCOsabPruaUd37EmteSKjPxYGKxxpVZ8lBrSheo
 Crwkr6MCbICxfa+5gVw7FyFsPaCbtGpL9cAQ+efsxaOmyjvdgFRiQfuQKXbJ6KhfcJPVyZ2Ay94Y
 S4DYlbkBU2mjXGEHAuG7TLYCwAYWRPdqxqokqGBCcBKZClIAQAosaTRRNAByUHcm4F6abLMQQACq
 AHAFlAIqA9KyyVCqYwGsQN6oYN16IIKiUTC3Unh9jGJ+6io4BW14vHvPJa6AIH1IJdXkt9zoFp8X
 SMvpfbZpSqIwHfj3JRss4KUdelzU/Ab7VMYl5jZ9A+57jQag6idkAAAAJXRFWHRkYXRlOmNyZWF0
 ZQAyMDIxLTA2LTE5VDExOjU1OjQyKzAwOjAwGIeMmgAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMS0w
 Ni0xOVQxMTo1NTo0MiswMDowMGnaNCYAAAAASUVORK5CYII=
X-Now-Playing: Oval's _Scis_: "Cozzmo"
Date: Sat, 19 Jun 2021 14:14:47 +0200
In-Reply-To: <m2czsmagat.fsf@HIDDEN> (Alex Bochannek's message of "Tue, 
 15 Jun 2021 15:55:54 -0700")
Message-ID: <877diq2gqw.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Alex Bochannek <alex@HIDDEN> writes: > I tend to find
 it difficult to reason about functionality if constants > like this are in
 the code and not in variables. It may be unlikely that > many people will
 want to customize it, but I'd rath [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Alex Bochannek <alex@HIDDEN> writes:

> I tend to find it difficult to reason about functionality if constants
> like this are in the code and not in variables. It may be unlikely that
> many people will want to customize it, but I'd rather expose this as a
> configuration variable than hide a static value in the code.

Adding user options to control things nobody has asked about isn't
helpful.

> Support URL-specific cache expiration
>
> 	* test/lisp/url/url-cache-tests.el: Test URL-to-filename and
> 	filename-to-URL mappings used by URL caching.
>
> 	* lisp/url/url-cache.el (url-cache-expiry-alist)
> 	(url-cache-create-url-from-file, url-cache-expired)
> 	(url-cache-prune-cache): Expire cache entries based on regular
> 	expressions matching URLs defined in new customizable variable
> 	url-cache-expire-alist.
>
> 	* doc/misc/url.texi (Disk Caching): Mention
> 	url-cache-expiry-alist variable.

Looks good to me.  What's the use case for this, though?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#49033: 28.0.50; [PATCH] Feature suggestion, url-cache-expiry-alist to override expire time for cache pruning
Resent-From: Benjamin Riefenstahl <b.riefenstahl@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sat, 19 Jun 2021 12:57:01 +0000
Resent-Message-ID: <handler.49033.B49033.16241074146133 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 49033
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Alex Bochannek <alex@HIDDEN>
Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 49033 <at> debbugs.gnu.org
Received: via spool by 49033-submit <at> debbugs.gnu.org id=B49033.16241074146133
          (code B ref 49033); Sat, 19 Jun 2021 12:57:01 +0000
Received: (at 49033) by debbugs.gnu.org; 19 Jun 2021 12:56:54 +0000
Received: from localhost ([127.0.0.1]:58738 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1luaWr-0001ar-V5
	for submit <at> debbugs.gnu.org; Sat, 19 Jun 2021 08:56:54 -0400
Received: from odoacer.turtle-trading.net ([93.241.193.16]:49915)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <benny@HIDDEN>) id 1luaWp-0001aZ-T9
 for 49033 <at> debbugs.gnu.org; Sat, 19 Jun 2021 08:56:52 -0400
Received: from zenobia.turtle-trading.net ([192.168.2.109])
 by odoacer.turtle-trading.net with esmtp (Exim 4.80)
 (envelope-from <benny@HIDDEN>)
 id 1luaWe-0006SH-Mq; Sat, 19 Jun 2021 14:56:40 +0200
Received: from benny by zenobia.turtle-trading.net with local (Exim 4.92)
 (envelope-from <benny@HIDDEN>)
 id 1luaWe-0001xd-LT; Sat, 19 Jun 2021 14:56:40 +0200
From: Benjamin Riefenstahl <b.riefenstahl@HIDDEN>
References: <m2pmwnado2.fsf@HIDDEN> <87r1h3tdys.fsf@HIDDEN>
 <m2czsmagat.fsf@HIDDEN>
Date: Sat, 19 Jun 2021 14:56:40 +0200
In-Reply-To: <m2czsmagat.fsf@HIDDEN> (Alex Bochannek's message of "Tue, 
 15 Jun 2021 15:55:54 -0700")
Message-ID: <877diq108n.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Alex,

>>> -                 ;; Twelve hours.
>>> -                 (* 12 60 60))))
>>> +                 gravatar-cache-ttl)))

> Lars Ingebrigtsen <larsi@HIDDEN> writes:
>> I don't mind that -- but is this really something that somebody would
>> want to control?  It just seemed unlikely to me.

Alex Bochannek writes:
> I tend to find it difficult to reason about functionality if constants
> like this are in the code and not in variables.

Maybe use defconst instead?

Just a drive-by thought,
benny




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#49033: 28.0.50; [PATCH] Feature suggestion, url-cache-expiry-alist to override expire time for cache pruning
Resent-From: Alex Bochannek <alex@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sat, 19 Jun 2021 19:25:02 +0000
Resent-Message-ID: <handler.49033.B49033.162413064522514 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 49033
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Benjamin Riefenstahl <b.riefenstahl@HIDDEN>
Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 49033 <at> debbugs.gnu.org
Received: via spool by 49033-submit <at> debbugs.gnu.org id=B49033.162413064522514
          (code B ref 49033); Sat, 19 Jun 2021 19:25:02 +0000
Received: (at 49033) by debbugs.gnu.org; 19 Jun 2021 19:24:05 +0000
Received: from localhost ([127.0.0.1]:60843 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lugZY-0005r4-TT
	for submit <at> debbugs.gnu.org; Sat, 19 Jun 2021 15:24:05 -0400
Received: from ns.lapseofthought.com ([50.0.39.240]:58000
 helo=mail.lapseofthought.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <alex@HIDDEN>) id 1lugZX-0005qv-4L
 for 49033 <at> debbugs.gnu.org; Sat, 19 Jun 2021 15:24:03 -0400
Received: from awb-mbp.local (unknown
 [IPv6:2601:646:4200:b470:4428:b3c:b897:c3aa])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by mail.lapseofthought.com (Postfix) with ESMTPSA id 4G6m1X6Fbnz3pdpY;
 Sat, 19 Jun 2021 12:24:00 -0700 (PDT)
From: Alex Bochannek <alex@HIDDEN>
References: <m2pmwnado2.fsf@HIDDEN> <87r1h3tdys.fsf@HIDDEN>
 <m2czsmagat.fsf@HIDDEN> <877diq108n.fsf@HIDDEN>
Date: Sat, 19 Jun 2021 12:24:00 -0700
In-Reply-To: <877diq108n.fsf@HIDDEN> (Benjamin Riefenstahl's
 message of "Sat, 19 Jun 2021 14:56:40 +0200")
Message-ID: <m235tdodyn.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Authentication-Results: ORIGINATING;
 auth=pass smtp.auth=alex smtp.mailfrom=alex@HIDDEN
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

Benjamin Riefenstahl <b.riefenstahl@HIDDEN> writes:

> Hi Alex,
>
>>>> -                 ;; Twelve hours.
>>>> -                 (* 12 60 60))))
>>>> +                 gravatar-cache-ttl)))
>
>> Lars Ingebrigtsen <larsi@HIDDEN> writes:
>>> I don't mind that -- but is this really something that somebody would
>>> want to control?  It just seemed unlikely to me.
>
> Alex Bochannek writes:
>> I tend to find it difficult to reason about functionality if constants
>> like this are in the code and not in variables.
>
> Maybe use defconst instead?
>
> Just a drive-by thought,
> benny

I like that idea, that seems like a good compromise.

Thanks!

--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline

diff --git a/lisp/image/gravatar.el b/lisp/image/gravatar.el
index f6f056a2ba..ebae356e26 100644
--- a/lisp/image/gravatar.el
+++ b/lisp/image/gravatar.el
@@ -51,6 +51,9 @@ gravatar-cache-ttl
   :group 'gravatar)
 (make-obsolete-variable 'gravatar-cache-ttl nil "28.1")

+(defconst gravatar-cache-expiry (* 12 60 60)
+  "Time to live for gravatar cache entries (12 hours.)")
+
 (defcustom gravatar-rating "g"
   "Most explicit Gravatar rating level to allow.
 Some gravatars are rated according to how suitable they are for
@@ -287,8 +290,7 @@ gravatar-retrieve
 (defun gravatar--prune-cache ()
   (let ((expired nil)
         (time (- (time-convert (current-time) 'integer)
-                 ;; Twelve hours.
-                 (* 12 60 60))))
+                 gravatar-cache-expiry)))
     (maphash (lambda (key val)
                (when (< (car val) time)
                  (push key expired)))

--=-=-=
Content-Type: text/plain

-- 
Alex.

--=-=-=--




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#49033: 28.0.50; [PATCH] Feature suggestion, url-cache-expiry-alist to override expire time for cache pruning
Resent-From: Alex Bochannek <alex@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sat, 19 Jun 2021 19:33:02 +0000
Resent-Message-ID: <handler.49033.B49033.162413113823642 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 49033
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Lars Ingebrigtsen <larsi@HIDDEN>
Cc: 49033 <at> debbugs.gnu.org
Received: via spool by 49033-submit <at> debbugs.gnu.org id=B49033.162413113823642
          (code B ref 49033); Sat, 19 Jun 2021 19:33:02 +0000
Received: (at 49033) by debbugs.gnu.org; 19 Jun 2021 19:32:18 +0000
Received: from localhost ([127.0.0.1]:60849 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lughV-00069F-O4
	for submit <at> debbugs.gnu.org; Sat, 19 Jun 2021 15:32:17 -0400
Received: from ns.lapseofthought.com ([50.0.39.240]:45584
 helo=mail.lapseofthought.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <alex@HIDDEN>) id 1lughT-000697-LG
 for 49033 <at> debbugs.gnu.org; Sat, 19 Jun 2021 15:32:16 -0400
Received: from awb-mbp.local (unknown
 [IPv6:2601:646:4200:b470:4428:b3c:b897:c3aa])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by mail.lapseofthought.com (Postfix) with ESMTPSA id 4G6mC225zzz3pdrD;
 Sat, 19 Jun 2021 12:32:14 -0700 (PDT)
From: Alex Bochannek <alex@HIDDEN>
References: <m2pmwnado2.fsf@HIDDEN> <87r1h3tdys.fsf@HIDDEN>
 <m2czsmagat.fsf@HIDDEN> <877diq2gqw.fsf@HIDDEN>
Date: Sat, 19 Jun 2021 12:32:13 -0700
In-Reply-To: <877diq2gqw.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Sat,
 19 Jun 2021 14:14:47 +0200")
Message-ID: <m2y2b5mz0i.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin)
MIME-Version: 1.0
Content-Type: text/plain
Authentication-Results: ORIGINATING;
 auth=pass smtp.auth=alex smtp.mailfrom=alex@HIDDEN
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> Alex Bochannek <alex@HIDDEN> writes:
>
>> Support URL-specific cache expiration
>>
>> 	* test/lisp/url/url-cache-tests.el: Test URL-to-filename and
>> 	filename-to-URL mappings used by URL caching.
>>
>> 	* lisp/url/url-cache.el (url-cache-expiry-alist)
>> 	(url-cache-create-url-from-file, url-cache-expired)
>> 	(url-cache-prune-cache): Expire cache entries based on regular
>> 	expressions matching URLs defined in new customizable variable
>> 	url-cache-expire-alist.
>>
>> 	* doc/misc/url.texi (Disk Caching): Mention
>> 	url-cache-expiry-alist variable.
>
> Looks good to me.  What's the use case for this, though?

I originally had looked at this for Gravatar entries and I am now using
it to avoid fetching the same images in RSS feeds. I just noticed though
that `url-cache-create-url-from-file' won't work if
`url-cache-create-filename-human-readable' is used. Any suggestions for
how to address that?

-- 
Alex.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#49033: 28.0.50; [PATCH] Feature suggestion, url-cache-expiry-alist to override expire time for cache pruning
Resent-From: Lars Ingebrigtsen <larsi@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 21 Jun 2021 12:22:02 +0000
Resent-Message-ID: <handler.49033.B49033.162427811515155 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 49033
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Alex Bochannek <alex@HIDDEN>
Cc: 49033 <at> debbugs.gnu.org
Received: via spool by 49033-submit <at> debbugs.gnu.org id=B49033.162427811515155
          (code B ref 49033); Mon, 21 Jun 2021 12:22:02 +0000
Received: (at 49033) by debbugs.gnu.org; 21 Jun 2021 12:21:55 +0000
Received: from localhost ([127.0.0.1]:35714 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lvIw6-0003wN-Ny
	for submit <at> debbugs.gnu.org; Mon, 21 Jun 2021 08:21:54 -0400
Received: from quimby.gnus.org ([95.216.78.240]:51738)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1lvIw5-0003w8-AK
 for 49033 <at> debbugs.gnu.org; Mon, 21 Jun 2021 08:21:53 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=LpWlbxC0XtZ5seJwE4eJeekDQ+XYvWuLqpiHQQSYUZI=; b=rjy3XNJ4T0paoZp9VYbVLC99bt
 MuUcJtVfx/sSm43MRpuGioTZEtVxHsujQKhs7gjwk7i+fBys7pQnJwVyy7x5tc9ga+KKQz9lIGaKu
 M7oGOY7SQdj01Tz6fQ6KGALZteZcagySTtzHee0PKy+i3QpM/2iObqx34k6CK/sMROjk=;
Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=elva)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1lvIvw-0003hT-9K; Mon, 21 Jun 2021 14:21:46 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
References: <m2pmwnado2.fsf@HIDDEN> <87r1h3tdys.fsf@HIDDEN>
 <m2czsmagat.fsf@HIDDEN> <877diq2gqw.fsf@HIDDEN>
 <m2y2b5mz0i.fsf@HIDDEN>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEUuJTd0VoDEx+L/
 //+imcAGAAAAAWJLR0QDEQxM8gAAAAd0SU1FB+UGFQwKOlcjusAAAAFcSURBVCjPfZC/asJQFMa/
 E6LQTinkSs3UxcE+xbVoh04RPFKdKrTQ+hR26K4QHZwcUoh5yn7nRsWpJ4R7f/d85y+c3mC4mNZm
 gHtF+vGzbCB9QNzbzAK4YY5Rfxx0UPWQbDHSBkA4eJ2eAC8HJtItdBKAYj7r3BNKwsQhv6enXc23
 Ss8gD9DRmc6hnwblIz3M9i6ekNWFO0LfCFHVrvW4RL3GClEZ7Xc14QB6Stl/s4N9yQSosNwRjhWL
 SoW+9VZ/8R4V6GWEoIo2SXoFmZ+foH5adTs23Npg453NzYoxugVHWwbAUBRunDVApXeTrFbIWNdU
 tkY2Pksa2AeugZDw0gpAWSJ5ElRqyxIf2y5i9+vDo8WIKt8EjckVpI4hsTTSZOz9BUJgLDnOUUjP
 ntZdi0WfQxsCifnfFql1KjnDRXwaZD6BRThLNJDcwp3V5RmgfcoXjmiFi8X41/4AnMZxyJcWb5kA
 AAAldEVYdGRhdGU6Y3JlYXRlADIwMjEtMDYtMjFUMTI6MTA6NTgrMDA6MDC77sOJAAAAJXRFWHRk
 YXRlOm1vZGlmeQAyMDIxLTA2LTIxVDEyOjEwOjU4KzAwOjAwyrN7NQAAAABJRU5ErkJggg==
X-Now-Playing: Yes's _Tormato_: "Some Are Born (Previously Unissued)"
Date: Mon, 21 Jun 2021 14:21:43 +0200
In-Reply-To: <m2y2b5mz0i.fsf@HIDDEN> (Alex Bochannek's message of "Sat, 
 19 Jun 2021 12:32:13 -0700")
Message-ID: <87lf73tnl4.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Alex Bochannek <alex@HIDDEN> writes: > I originally
 had looked at this for Gravatar entries and I am now using > it to avoid
 fetching the same images in RSS feeds. Right; makes sense. 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Alex Bochannek <alex@HIDDEN> writes:

> I originally had looked at this for Gravatar entries and I am now using
> it to avoid fetching the same images in RSS feeds.

Right; makes sense.

> I just noticed though that `url-cache-create-url-from-file' won't work
> if `url-cache-create-filename-human-readable' is used. Any suggestions
> for how to address that?

No, sorry -- I'm pretty unfamiliar with the url-cache code.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#49033: 28.0.50; [PATCH] Feature suggestion, url-cache-expiry-alist to override expire time for cache pruning
Resent-From: Alex Bochannek <alex@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 21 Jun 2021 18:26:01 +0000
Resent-Message-ID: <handler.49033.B49033.162429991323886 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 49033
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: Lars Ingebrigtsen <larsi@HIDDEN>
Cc: 49033 <at> debbugs.gnu.org
Received: via spool by 49033-submit <at> debbugs.gnu.org id=B49033.162429991323886
          (code B ref 49033); Mon, 21 Jun 2021 18:26:01 +0000
Received: (at 49033) by debbugs.gnu.org; 21 Jun 2021 18:25:13 +0000
Received: from localhost ([127.0.0.1]:36908 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lvObh-0006DC-7r
	for submit <at> debbugs.gnu.org; Mon, 21 Jun 2021 14:25:13 -0400
Received: from ns.lapseofthought.com ([50.0.39.240]:58674
 helo=mail.lapseofthought.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <alex@HIDDEN>) id 1lvObe-0006D1-W5
 for 49033 <at> debbugs.gnu.org; Mon, 21 Jun 2021 14:25:12 -0400
Received: from awb-mbp.local (unknown
 [IPv6:2601:646:4200:b470:e85b:bfc1:2231:95d9])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by mail.lapseofthought.com (Postfix) with ESMTPSA id 4G7ycj6Vm7z3pdX4;
 Mon, 21 Jun 2021 11:25:09 -0700 (PDT)
From: Alex Bochannek <alex@HIDDEN>
References: <m2pmwnado2.fsf@HIDDEN> <87r1h3tdys.fsf@HIDDEN>
 <m2czsmagat.fsf@HIDDEN> <877diq2gqw.fsf@HIDDEN>
 <m2y2b5mz0i.fsf@HIDDEN> <87lf73tnl4.fsf@HIDDEN>
Date: Mon, 21 Jun 2021 11:25:09 -0700
In-Reply-To: <87lf73tnl4.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Mon,
 21 Jun 2021 14:21:43 +0200")
Message-ID: <m2y2b3krcq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin)
MIME-Version: 1.0
Content-Type: text/plain
Authentication-Results: ORIGINATING;
 auth=pass smtp.auth=alex smtp.mailfrom=alex@HIDDEN
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> Alex Bochannek <alex@HIDDEN> writes:
>
>> I originally had looked at this for Gravatar entries and I am now using
>> it to avoid fetching the same images in RSS feeds.
>
> Right; makes sense.
>
>> I just noticed though that `url-cache-create-url-from-file' won't work
>> if `url-cache-create-filename-human-readable' is used. Any suggestions
>> for how to address that?
>
> No, sorry -- I'm pretty unfamiliar with the url-cache code.

I need to think about this some more. The easy way is to not try to
recreate the URL but to have users specify the path for cache entries. I
might just do that and see how that works out for me in practice. Either
way, it's not ready for merging yet.

Thanks!

-- 
Alex.




Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 1 Aug 2021 11:16:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 01 07:16:27 2021
Received: from localhost ([127.0.0.1]:35745 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mA9SF-0003IP-Qu
	for submit <at> debbugs.gnu.org; Sun, 01 Aug 2021 07:16:27 -0400
Received: from quimby.gnus.org ([95.216.78.240]:34914)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1mA9SB-0003IA-QJ
 for control <at> debbugs.gnu.org; Sun, 01 Aug 2021 07:16:26 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=calthUw1s9/UxCbITZa6YcUxQaerAgEFn+TG4eC3KLg=; b=gSggSbnZOmRWUgv5rQgcTjQlAg
 RL4nyPgJ1QTJbBvOvXihkCFMu3ARqPLw1v5p1XKzt2c0R4aBXZtuPYUIzCtlFzTlVewA8UjYbR4yw
 MEOAzzhIMNjAkx7NQj8taWghn+NPYcrAZg3OvcE22dddrvVJ+9V5CdlgFOVCaCyc/Ggw=;
Received: from 2.149.45.105.tmi.telenormobil.no ([2.149.45.105] helo=elva)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>) id 1mA9S3-0001Eb-8t
 for control <at> debbugs.gnu.org; Sun, 01 Aug 2021 13:16:17 +0200
Date: Sun, 01 Aug 2021 13:16:13 +0200
Message-Id: <87o8ah76v6.fsf@HIDDEN>
To: control <at> debbugs.gnu.org
From: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: control message for bug #49033
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  tags 49033 - patch quit 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 0.0 TVD_RCVD_IP            Message was received from an IP address
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

tags 49033 - patch
quit





Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#49033: 28.0.50; [PATCH] Feature suggestion, url-cache-expiry-alist to override expire time for cache pruning
Resent-From: Stefan Kangas <stefan@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 24 Oct 2021 07:28:03 +0000
Resent-Message-ID: <handler.49033.B49033.163506044528146 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 49033
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Alex Bochannek <alex@HIDDEN>
Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 49033 <at> debbugs.gnu.org
Received: via spool by 49033-submit <at> debbugs.gnu.org id=B49033.163506044528146
          (code B ref 49033); Sun, 24 Oct 2021 07:28:03 +0000
Received: (at 49033) by debbugs.gnu.org; 24 Oct 2021 07:27:25 +0000
Received: from localhost ([127.0.0.1]:37801 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1meXuf-0007Jt-Cw
	for submit <at> debbugs.gnu.org; Sun, 24 Oct 2021 03:27:25 -0400
Received: from mail-pg1-f181.google.com ([209.85.215.181]:46649)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1meXuc-0007Ja-KU
 for 49033 <at> debbugs.gnu.org; Sun, 24 Oct 2021 03:27:23 -0400
Received: by mail-pg1-f181.google.com with SMTP id m21so7659242pgu.13
 for <49033 <at> debbugs.gnu.org>; Sun, 24 Oct 2021 00:27:22 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:in-reply-to:references:user-agent
 :mime-version:date:message-id:subject:to:cc;
 bh=9GQKjP5kpllr/N8nRCpYxrqB1EKcvWfWphaYCBEEzTA=;
 b=7vqofA0vSFhwPbxC8GOfR/adm+9y6VGlbwJ5Azu6vcUMvRKDdK5hED7E+BAPIetQ2+
 NBlggGYyeLsM72lebNmIWMt6bRv+qVYu3vSAqX5OsYDA39dyMNvfjpgKb3yHs//QX2A0
 U4yXsw7fNYzl4l9kZMy0VXCsuQe7crDif59ZSTnZvQtNcv21hUv8An35cdffGX9xHBiV
 XF8MHJ4dDCF0LurxXMqZLFbFtS4g1x2O4sOBl17Rjn8Ex/F41srLo+rNhJUEMziAYlhB
 HV1A00Rstr8Vgd2EJP26lYTMOZ9y2DPfVSAd2xfH5wCD3vCI1x7rHELZ26zpR72iNEwn
 SswQ==
X-Gm-Message-State: AOAM532skkOTQS2OnbHwj1VbigcOv+gWm5ZS0xneoz4bjs6eQYkztE84
 eJIgupwOuuJBoIESn8oJ7gljkcjCfvPLXMpoaCWbnZEe
X-Google-Smtp-Source: ABdhPJwaqGFIFltedABxBAmWwleVHI0Egvr/V4w2Mx+pzxIOQp26EeI4cVFN9524+MjbYxt01Q8/KXimsnsHNfU4eLg=
X-Received: by 2002:a63:81c2:: with SMTP id t185mr7974766pgd.114.1635060437024; 
 Sun, 24 Oct 2021 00:27:17 -0700 (PDT)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Sun, 24 Oct 2021 00:27:16 -0700
From: Stefan Kangas <stefan@HIDDEN>
In-Reply-To: <m2y2b3krcq.fsf@HIDDEN> (Alex Bochannek's message of "Mon, 
 21 Jun 2021 11:25:09 -0700")
References: <m2pmwnado2.fsf@HIDDEN> <87r1h3tdys.fsf@HIDDEN>
 <m2czsmagat.fsf@HIDDEN> <877diq2gqw.fsf@HIDDEN>
 <m2y2b5mz0i.fsf@HIDDEN>
 <87lf73tnl4.fsf@HIDDEN> <m2y2b3krcq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Date: Sun, 24 Oct 2021 00:27:16 -0700
Message-ID: <CADwFkmnD3pGRHq5QBSbt7YA1SQ8AJiZZrLX8167A8FA+-VKJJg@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.5 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)

Alex Bochannek <alex@HIDDEN> writes:

> Lars Ingebrigtsen <larsi@HIDDEN> writes:
>
>> Alex Bochannek <alex@HIDDEN> writes:
>>
>>> I originally had looked at this for Gravatar entries and I am now using
>>> it to avoid fetching the same images in RSS feeds.
>>
>> Right; makes sense.
>>
>>> I just noticed though that `url-cache-create-url-from-file' won't work
>>> if `url-cache-create-filename-human-readable' is used. Any suggestions
>>> for how to address that?
>>
>> No, sorry -- I'm pretty unfamiliar with the url-cache code.
>
> I need to think about this some more. The easy way is to not try to
> recreate the URL but to have users specify the path for cache entries. I
> might just do that and see how that works out for me in practice. Either
> way, it's not ready for merging yet.

(That was 17 weeks ago.)

Did you get any further here?  Thanks in advance.





Last modified: Sun, 24 Oct 2021 07:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.