GNU bug report logs -
#49033
28.0.50; [PATCH] Feature suggestion, url-cache-expiry-alist to override expire time for cache pruning
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Benjamin Riefenstahl <b.riefenstahl <at> turtle-trading.net> writes:
> Hi Alex,
>
>>>> - ;; Twelve hours.
>>>> - (* 12 60 60))))
>>>> + gravatar-cache-ttl)))
>
>> Lars Ingebrigtsen <larsi <at> 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!
[Message part 2 (text/x-patch, 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)))
[Message part 3 (text/plain, inline)]
--
Alex.
This bug report was last modified 220 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.