all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alex Bochannek <alex@bochannek.com>
To: Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
Cc: Lars Ingebrigtsen <larsi@gnus.org>, 49033@debbugs.gnu.org
Subject: bug#49033: 28.0.50; [PATCH] Feature suggestion, url-cache-expiry-alist to override expire time for cache pruning
Date: Sat, 19 Jun 2021 12:24:00 -0700	[thread overview]
Message-ID: <m235tdodyn.fsf@bochannek.com> (raw)
In-Reply-To: <877diq108n.fsf@turtle-trading.net> (Benjamin Riefenstahl's message of "Sat, 19 Jun 2021 14:56:40 +0200")

[-- Attachment #1: Type: text/plain, Size: 661 bytes --]

Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net> writes:

> Hi Alex,
>
>>>> -                 ;; Twelve hours.
>>>> -                 (* 12 60 60))))
>>>> +                 gravatar-cache-ttl)))
>
>> Lars Ingebrigtsen <larsi@gnus.org> 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!

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 899 bytes --]

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)))

[-- Attachment #3: Type: text/plain, Size: 10 bytes --]

-- 
Alex.

      reply	other threads:[~2021-06-19 19:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-15  5:40 bug#49033: 28.0.50; [PATCH] Feature suggestion, url-cache-expiry-alist to override expire time for cache pruning Alex Bochannek
2021-06-15 14:11 ` Lars Ingebrigtsen
2021-06-15 22:55   ` Alex Bochannek
2021-06-19 12:14     ` Lars Ingebrigtsen
2021-06-19 19:32       ` Alex Bochannek
2021-06-21 12:21         ` Lars Ingebrigtsen
2021-06-21 18:25           ` Alex Bochannek
2021-10-24  7:27             ` Stefan Kangas
2021-10-27 16:36               ` Alex Bochannek
2021-10-27 16:50                 ` Stefan Kangas
2021-06-19 12:56     ` Benjamin Riefenstahl
2021-06-19 19:24       ` Alex Bochannek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m235tdodyn.fsf@bochannek.com \
    --to=alex@bochannek.com \
    --cc=49033@debbugs.gnu.org \
    --cc=b.riefenstahl@turtle-trading.net \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.