[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: feature request: caching



radford@robby.caltech.edu (Jim Radford) writes:

> > I think 1 would improve the situation the most, it should be
> > implemented. Consistency of data is of course the problem, it's
> > probably somewhat tricky to do this correct.
> 
> What type of data are you thinking of keeping?

nnimap-request-list stuff.

Nnimap wouldn't do a UID FETCH 1,* (UID) in every group but instead
use it's locally stored information until someone selects this
group. Netscape does this, and I think most clients do this. Checking
for new articles in every group on startup is very time consuming.

I'm not sure how you tell Gnus about this change though, anyone?

> Gnus already have a facility for this.  See "Article Caching" in the
> info.

I'm now using:

(setq gnus-use-cache t)
(setq gnus-cache-directory "~/Mail/cache/")
(setq gnus-cache-enter-articles '(ticked dormant read unread))
(setq gnus-cache-remove-articles nil)
(setq gnus-cacheable-groups "^nnimap")

Only problem is that I can't get it to enter already read articles
into the cache, perhaps a bug.

One additional room for improvement in gnus-cache would be a
gnus-cache-remove-articles flag 'old' which removes files from the
cache with a file date older than (new variable)
gnus-cache-remove-wait days.

I think this will solve number 2 on Mark Moll's wish list.

/s

Patch to gnus-cache for a gnus-cacheable-groups variable (also sent to
Larsi):

--- gnus-cache.el-      Wed Aug 12 20:14:50 1998
+++ gnus-cache.el       Wed Aug 12 21:05:19 1998
@@ -50,11 +50,26 @@
   :group 'gnus-cache
   :type '(set (const ticked) (const dormant) (const unread) (const read)))
 
+(defcustom gnus-cacheable-groups nil
+  "*Groups that match this regexp will be cached.
+
+If you only want to cache your nntp groups, you could set this
+variable to \"^nntp\".
+
+If a group matches both gnus-cacheable-groups and gnus-uncacheable-groups
+it's not cached."
+  :group 'gnus-cache
+  :type '(choice (const :tag "off" nil)
+                regexp))
+
 (defcustom gnus-uncacheable-groups nil
   "*Groups that match this regexp will not be cached.
 
 If you want to avoid caching your nnml groups, you could set this
-variable to \"^nnml\"."
+variable to \"^nnml\".
+
+If a group matches both gnus-cacheable-groups and gnus-uncacheable-groups
+it's not cached."
   :group 'gnus-cache
   :type '(choice (const :tag "off" nil)
                 regexp))
@@ -136,10 +151,20 @@
        (mail-header-set-number headers (cdr result))))
     (let ((number (mail-header-number headers))
          file dir)
+      (message "grupp: %s 1: %s 2: %s 3: %s" group
+              (or (not gnus-cacheable-groups)
+                             (string-match gnus-cacheable-groups group))
+              (or (not gnus-uncacheable-groups)
+                  (not (string-match
+                        gnus-uncacheable-groups group)))
+              (gnus-cache-member-of-class
+               gnus-cache-enter-articles ticked dormant unread))
       (when (and number
                 (> number 0)           ; Reffed article.
                 (or force
-                    (and (or (not gnus-uncacheable-groups)
+                    (and (or (not gnus-cacheable-groups)
+                             (string-match gnus-cacheable-groups group))
+                         (or (not gnus-uncacheable-groups)
                              (not (string-match
                                    gnus-uncacheable-groups group)))
                          (gnus-cache-member-of-class
--- gnus.texi-  Wed Aug 12 21:21:55 1998
+++ gnus.texi   Wed Aug 12 21:23:13 1998
@@ -5293,13 +5293,17 @@
 not then be downloaded by this command.
 
 @vindex gnus-uncacheable-groups
-It is likely that you do not want caching on some groups.  For instance,
+@vindex gnus-cacheable-groups
+It is likely that you do not want caching on all groups.  For instance,
 if your @code{nnml} mail is located under your home directory, it makes no
 sense to cache it somewhere else under your home directory.  Unless you
-feel that it's neat to use twice as much space.  To limit the caching,
-you could set the @code{gnus-uncacheable-groups} regexp to
-@samp{^nnml}, for instance.  This variable is @code{nil} by
-default.
+feel that it's neat to use twice as much space.  
+
+To limit the caching, you could set @code{gnus-cacheable-groups} to a
+regexp of groups to cache, @samp{^nntp} for instance, or set the
+@code{gnus-uncacheable-groups} regexp to @samp{^nnml}, for instance.
+Both variables are @code{nil} by default. If a group matches both
+variables, the group is not cached.
 
 @findex gnus-cache-generate-nov-databases
 @findex gnus-cache-generate-active
@@ -17567,9 +17571,6 @@
 @item
  new Date score match types -- < > = (etc) that take floating point
 numbers and match on the age of the article.
-
-@item
- gnus-cacheable-groups
 
 @item
 @example