1 ;;; gnus-cache.el --- cache interface for Gnus
2 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
3 ;; Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6 ;; Tatsuya Ichikawa <t-ichi@po.shiojiri.ne.jp>
7 ;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
31 (eval-when-compile (require 'cl))
32 (eval-when-compile (require 'gnus-clfns))
39 (if (not (fboundp 'gnus-agent-load-alist))
40 (defun gnus-agent-load-alist (group)))
43 (defcustom gnus-cache-active-file
44 (expand-file-name "active" gnus-cache-directory)
45 "*The cache active file."
49 (defcustom gnus-cache-enter-articles '(ticked dormant)
50 "Classes of articles to enter into the cache."
52 :type '(set (const ticked) (const dormant) (const unread) (const read)))
54 (defcustom gnus-cache-remove-articles '(read)
55 "Classes of articles to remove from the cache."
57 :type '(set (const ticked) (const dormant) (const unread) (const read)))
59 (defcustom gnus-cacheable-groups nil
60 "*Groups that match this regexp will be cached.
62 If you only want to cache your nntp groups, you could set this
63 variable to \"^nntp\".
65 If a group matches both gnus-cacheable-groups and gnus-uncacheable-groups
68 :type '(choice (const :tag "off" nil)
71 (defcustom gnus-uncacheable-groups nil
72 "*Groups that match this regexp will not be cached.
74 If you want to avoid caching your nnml groups, you could set this
75 variable to \"^nnml\".
77 If a group matches both gnus-cacheable-groups and gnus-uncacheable-groups
80 :type '(choice (const :tag "off" nil)
83 (defvar gnus-cache-overview-coding-system 'raw-text
84 "Coding system used on Gnus cache files.")
86 (defvar gnus-cache-coding-system 'raw-text
87 "Coding system used on Gnus cache files.")
91 ;;; Internal variables.
93 (defvar gnus-cache-removable-articles nil)
94 (defvar gnus-cache-buffer nil)
95 (defvar gnus-cache-active-hashtb nil)
96 (defvar gnus-cache-active-altered nil)
97 (defvar gnus-cache-write-file-coding-system 'raw-text)
100 (autoload 'nnml-generate-nov-databases-1 "nnml")
101 (autoload 'nnvirtual-find-group-art "nnvirtual"))
105 ;;; Functions called from Gnus.
107 (defun gnus-cache-open ()
108 "Initialize the cache."
109 (when (or (file-exists-p gnus-cache-directory)
111 (not (eq gnus-use-cache 'passive))))
112 (gnus-cache-read-active)))
114 ;; Complexities of byte-compiling make this kludge necessary. Eeek.
116 (gnus-add-shutdown 'gnus-cache-close 'gnus))
118 (defun gnus-cache-close ()
119 "Shut down the cache."
120 (gnus-cache-write-active)
121 (gnus-cache-save-buffers)
122 (setq gnus-cache-active-hashtb nil))
124 (defun gnus-cache-save-buffers ()
125 ;; save the overview buffer if it exists and has been modified
126 ;; delete empty cache subdirectories
127 (when gnus-cache-buffer
128 (let ((buffer (cdr gnus-cache-buffer))
129 (overview-file (gnus-cache-file-name
130 (car gnus-cache-buffer) ".overview")))
131 ;; write the overview only if it was modified
132 (when (buffer-modified-p buffer)
135 (if (> (buffer-size) 0)
136 ;; Non-empty overview, write it to a file.
137 (gnus-write-buffer-as-coding-system
138 gnus-cache-overview-coding-system overview-file)
139 ;; Empty overview file, remove it
140 (when (file-exists-p overview-file)
141 (delete-file overview-file))
142 ;; If possible, remove group's cache subdirectory.
144 ;; FIXME: we can detect the error type and warn the user
145 ;; of any inconsistencies (articles w/o nov entries?).
146 ;; for now, just be conservative...delete only if safe -- sj
147 (delete-directory (file-name-directory overview-file))
149 ;; Kill the buffer -- it's either unmodified or saved.
150 (gnus-kill-buffer buffer)
151 (setq gnus-cache-buffer nil))))
153 (defun gnus-cache-possibly-enter-article
154 (group article headers ticked dormant unread &optional force)
155 (when (and (or force (not (eq gnus-use-cache 'passive)))
157 (> article 0) ; This might be a dummy article.
159 (let ((number article) file)
160 ;; If this is a virtual group, we find the real group.
161 (when (gnus-virtual-group-p group)
162 (let ((result (nnvirtual-find-group-art
163 (gnus-group-real-name group) article)))
164 (setq group (car result)
165 number (cdr result))))
167 (> number 0) ; Reffed article.
169 (and (gnus-cache-fully-p group)
170 (gnus-cache-member-of-class
171 gnus-cache-enter-articles ticked dormant unread)))
172 (not (file-exists-p (setq file (gnus-cache-file-name
174 ;; Possibly create the cache directory.
175 (gnus-make-directory (file-name-directory file))
176 ;; Save the article in the cache.
177 (if (file-exists-p file)
178 t ; The article already is saved.
180 (set-buffer nntp-server-buffer)
182 (let ((gnus-use-cache nil)
183 (gnus-article-decode-hook nil))
184 (gnus-request-article-this-buffer number group))
185 (when (> (buffer-size) 0)
186 (gnus-write-buffer-as-coding-system
187 gnus-cache-write-file-coding-system file)
188 (nnheader-remove-body)
189 (setq headers (nnheader-parse-naked-head))
190 (mail-header-set-number headers number)
191 (gnus-cache-change-buffer group)
192 (set-buffer (cdr gnus-cache-buffer))
193 (goto-char (point-max))
195 (while (condition-case ()
197 (> (read (current-buffer)) number))
199 ;; The line was malformed, so we just remove it!!
207 (when (< (read (current-buffer)) number)
212 (nnheader-insert-nov headers)
213 ;; Update the active info.
214 (set-buffer gnus-summary-buffer)
215 (gnus-cache-possibly-update-active group (cons number number))
216 (setq gnus-newsgroup-cached
217 (gnus-add-to-sorted-list gnus-newsgroup-cached article))
218 (gnus-summary-update-secondary-mark article))
221 (defun gnus-cache-enter-remove-article (article)
222 "Mark ARTICLE for later possible removal."
224 (push article gnus-cache-removable-articles)))
226 (defun gnus-cache-possibly-remove-articles ()
227 "Possibly remove some of the removable articles."
228 (if (not (gnus-virtual-group-p gnus-newsgroup-name))
229 (gnus-cache-possibly-remove-articles-1)
230 (let ((arts gnus-cache-removable-articles)
233 (when (setq ga (nnvirtual-find-group-art
234 (gnus-group-real-name gnus-newsgroup-name) (pop arts)))
235 (let ((gnus-cache-removable-articles (list (cdr ga)))
236 (gnus-newsgroup-name (car ga)))
237 (gnus-cache-possibly-remove-articles-1)))))
238 (setq gnus-cache-removable-articles nil)))
240 (defun gnus-cache-possibly-remove-articles-1 ()
241 "Possibly remove some of the removable articles."
242 (when (gnus-cache-fully-p gnus-newsgroup-name)
243 (let ((articles gnus-cache-removable-articles)
244 (cache-articles gnus-newsgroup-cached)
246 (gnus-cache-change-buffer gnus-newsgroup-name)
248 (when (memq (setq article (pop articles)) cache-articles)
249 ;; The article was in the cache, so we see whether we are
250 ;; supposed to remove it from the cache.
251 (gnus-cache-possibly-remove-article
252 article (memq article gnus-newsgroup-marked)
253 (memq article gnus-newsgroup-dormant)
254 (or (memq article gnus-newsgroup-unreads)
255 (memq article gnus-newsgroup-unselected))))))
256 ;; The overview file might have been modified, save it
257 ;; safe because we're only called at group exit anyway.
258 (gnus-cache-save-buffers)))
260 (defun gnus-cache-request-article (article group)
261 "Retrieve ARTICLE in GROUP from the cache."
262 (let ((file (gnus-cache-file-name group article))
263 (buffer-read-only nil))
264 (when (file-exists-p file)
266 (gnus-kill-all-overlays)
267 (let ((nnheader-file-coding-system gnus-cache-coding-system))
268 (nnheader-insert-file-contents file))
271 (defun gnus-cache-possibly-alter-active (group active)
272 "Alter the ACTIVE info for GROUP to reflect the articles in the cache."
273 (when gnus-cache-active-hashtb
274 (let ((cache-active (gnus-gethash group gnus-cache-active-hashtb)))
276 (when (< (car cache-active) (car active))
277 (setcar active (car cache-active)))
278 (when (> (cdr cache-active) (cdr active))
279 (setcdr active (cdr cache-active)))))))
281 (defun gnus-cache-retrieve-headers (articles group &optional fetch-old)
282 "Retrieve the headers for ARTICLES in GROUP."
284 (setq gnus-newsgroup-cached (gnus-cache-articles-in-group group))))
286 ;; No cached articles here, so we just retrieve them
288 (let ((gnus-use-cache nil))
289 (gnus-retrieve-headers articles group fetch-old))
290 (let ((uncached-articles (gnus-sorted-difference articles cached))
291 (cache-file (gnus-cache-file-name group ".overview"))
293 ;; We first retrieve all the headers that we don't have in
295 (let ((gnus-use-cache nil))
296 (when uncached-articles
297 (setq type (and articles
298 (gnus-retrieve-headers
299 uncached-articles group fetch-old)))))
300 (gnus-cache-save-buffers)
301 ;; Then we insert the cached headers.
304 ((not (file-exists-p cache-file))
305 ;; There are no cached headers.
308 ;; There were no uncached headers (or retrieval was
309 ;; unsuccessful), so we use the cached headers exclusively.
310 (set-buffer nntp-server-buffer)
312 (let ((nnheader-file-coding-system
313 gnus-cache-overview-coding-system))
314 (nnheader-insert-file-contents cache-file))
317 ;; We have both cached and uncached NOV headers, so we
319 (gnus-cache-braid-nov group cached)
323 (gnus-cache-braid-heads group (gnus-sorted-intersection
327 (defun gnus-cache-enter-article (&optional n)
328 "Enter the next N articles into the cache.
329 If not given a prefix, use the process marked articles instead.
330 Returns the list of articles entered."
332 (let ((articles (gnus-summary-work-articles n))
334 (while (setq article (pop articles))
335 (gnus-summary-remove-process-mark article)
336 (if (natnump article)
337 (when (gnus-cache-possibly-enter-article
338 gnus-newsgroup-name article
339 (gnus-summary-article-header article)
341 (setq gnus-newsgroup-undownloaded (delq article gnus-newsgroup-undownloaded))
343 (gnus-message 2 "Can't cache article %d" article))
344 (gnus-summary-update-download-mark article)
345 (gnus-summary-update-secondary-mark article))
346 (gnus-summary-next-subject 1)
347 (gnus-summary-position-point)
350 (defun gnus-cache-remove-article (&optional n)
351 "Remove the next N articles from the cache.
352 If not given a prefix, use the process marked articles instead.
353 Returns the list of articles removed."
355 (gnus-cache-change-buffer gnus-newsgroup-name)
356 (let ((articles (gnus-summary-work-articles n))
359 (setq article (pop articles))
360 (gnus-summary-remove-process-mark article)
361 (when (gnus-cache-possibly-remove-article article nil nil nil t)
362 (when gnus-newsgroup-agentized
363 (let ((alist (gnus-agent-load-alist gnus-newsgroup-name)))
364 (unless (cdr (assoc article alist))
365 (setq gnus-newsgroup-undownloaded
366 (gnus-add-to-sorted-list
367 gnus-newsgroup-undownloaded article)))))
369 (gnus-summary-update-download-mark article)
370 (gnus-summary-update-secondary-mark article))
371 (gnus-summary-next-subject 1)
372 (gnus-summary-position-point)
375 (defun gnus-cached-article-p (article)
376 "Say whether ARTICLE is cached in the current group."
377 (memq article gnus-newsgroup-cached))
379 (defun gnus-summary-insert-cached-articles ()
380 "Insert all the articles cached for this group into the current buffer."
382 (let ((gnus-verbose (max 6 gnus-verbose)))
383 (if (not gnus-newsgroup-cached)
384 (gnus-message 3 "No cached articles for this group")
385 (gnus-summary-goto-subjects gnus-newsgroup-cached))))
387 (defun gnus-summary-limit-include-cached ()
388 "Limit the summary buffer to articles that are cached."
390 (let ((gnus-verbose (max 6 gnus-verbose)))
391 (if gnus-newsgroup-cached
393 (gnus-summary-limit gnus-newsgroup-cached)
394 (gnus-summary-position-point))
395 (gnus-message 3 "No cached articles for this group"))))
397 ;;; Internal functions.
399 (defun gnus-cache-change-buffer (group)
400 (and gnus-cache-buffer
401 ;; See if the current group's overview cache has been loaded.
402 (or (string= group (car gnus-cache-buffer))
403 ;; Another overview cache is current, save it.
404 (gnus-cache-save-buffers)))
405 ;; if gnus-cache buffer is nil, create it
406 (unless gnus-cache-buffer
407 ;; Create cache buffer
409 (setq gnus-cache-buffer
411 (set-buffer (gnus-get-buffer-create
412 " *gnus-cache-overview*"))))
413 ;; Insert the contents of this group's cache overview.
415 (let ((file (gnus-cache-file-name group ".overview")))
416 (when (file-exists-p file)
417 (nnheader-insert-file-contents file)))
418 ;; We have a fresh (empty/just loaded) buffer,
419 ;; mark it as unmodified to save a redundant write later.
420 (set-buffer-modified-p nil))))
422 ;; Return whether an article is a member of a class.
423 (defun gnus-cache-member-of-class (class ticked dormant unread)
424 (or (and ticked (memq 'ticked class))
425 (and dormant (memq 'dormant class))
426 (and unread (memq 'unread class))
427 (and (not unread) (not ticked) (not dormant) (memq 'read class))))
429 (defun gnus-cache-file-name (group article)
431 (if (stringp article) article (int-to-string article))
432 (file-name-as-directory
434 (nnheader-translate-file-chars
435 (if (gnus-use-long-file-name 'not-cache)
437 (let ((group (nnheader-replace-duplicate-chars-in-string
438 (nnheader-replace-chars-in-string group ?/ ?_)
440 ;; Translate the first colon into a slash.
441 (when (string-match ":" group)
442 (setq group (concat (substring group 0 (match-beginning 0))
443 "/" (substring group (match-end 0)))))
444 (nnheader-replace-chars-in-string group ?. ?/)))
446 gnus-cache-directory))))
448 (defun gnus-cache-update-article (group article)
449 "If ARTICLE is in the cache, remove it and re-enter it."
450 (gnus-cache-change-buffer group)
451 (when (gnus-cache-possibly-remove-article article nil nil nil t)
452 (let ((gnus-use-cache nil))
453 (gnus-cache-possibly-enter-article
454 gnus-newsgroup-name article (gnus-summary-article-header article)
457 (defun gnus-cache-possibly-remove-article (article ticked dormant unread
459 "Possibly remove ARTICLE from the cache."
460 (let ((group gnus-newsgroup-name)
463 ;; If this is a virtual group, we find the real group.
464 (when (gnus-virtual-group-p group)
465 (let ((result (nnvirtual-find-group-art
466 (gnus-group-real-name group) article)))
467 (setq group (car result)
468 number (cdr result))))
469 (setq file (gnus-cache-file-name group number))
470 (when (and (file-exists-p file)
472 (gnus-cache-member-of-class
473 gnus-cache-remove-articles ticked dormant unread)))
476 (set-buffer (cdr gnus-cache-buffer))
477 (goto-char (point-min))
478 (when (or (looking-at (concat (int-to-string number) "\t"))
479 (search-forward (concat "\n" (int-to-string number) "\t")
482 (unless (setq gnus-newsgroup-cached
483 (delq article gnus-newsgroup-cached))
484 (gnus-sethash gnus-newsgroup-name nil gnus-cache-active-hashtb)
485 (setq gnus-cache-active-altered t))
486 (gnus-summary-update-secondary-mark article)
489 (defun gnus-cache-articles-in-group (group)
490 "Return a sorted list of cached articles in GROUP."
491 (let ((dir (file-name-directory (gnus-cache-file-name group 1)))
493 (when (file-exists-p dir)
495 (sort (mapcar (lambda (name) (string-to-int name))
496 (directory-files dir nil "^[0-9]+$" t))
498 ;; Update the cache active file, just to synch more.
501 (gnus-cache-update-active group (car articles) t)
502 (gnus-cache-update-active group (car (last articles))))
503 (when (gnus-gethash group gnus-cache-active-hashtb)
504 (gnus-sethash group nil gnus-cache-active-hashtb)
505 (setq gnus-cache-active-altered t)))
508 (defun gnus-cache-braid-nov (group cached &optional file)
509 (let ((cache-buf (gnus-get-buffer-create " *gnus-cache*"))
511 (gnus-cache-save-buffers)
513 (set-buffer cache-buf)
515 (let ((nnheader-file-coding-system gnus-cache-overview-coding-system))
516 (nnheader-insert-file-contents
517 (or file (gnus-cache-file-name group ".overview"))))
518 (goto-char (point-min))
520 (goto-char (point-min)))
521 (set-buffer nntp-server-buffer)
522 (goto-char (point-min))
524 (while (and (not (eobp))
525 (< (read (current-buffer)) (car cached)))
528 (set-buffer cache-buf)
529 (if (search-forward (concat "\n" (int-to-string (car cached)) "\t")
531 (setq beg (gnus-point-at-bol)
532 end (progn (end-of-line) (point)))
534 (set-buffer nntp-server-buffer)
536 (insert-buffer-substring cache-buf beg end)
538 (setq cached (cdr cached)))
539 (kill-buffer cache-buf)))
541 (defun gnus-cache-braid-heads (group cached)
542 (let ((cache-buf (gnus-get-buffer-create " *gnus-cache*")))
544 (set-buffer cache-buf)
546 (set-buffer nntp-server-buffer)
547 (goto-char (point-min))
549 (while (and (not (eobp))
550 (looking-at "2.. +\\([0-9]+\\) ")
551 (< (progn (goto-char (match-beginning 1))
552 (read (current-buffer)))
554 (search-forward "\n.\n" nil 'move))
557 (set-buffer cache-buf)
559 (let ((nnheader-file-coding-system gnus-cache-coding-system))
560 (nnheader-insert-file-contents
561 (gnus-cache-file-name group (car cached))))
562 (goto-char (point-min))
564 (princ (car cached) (current-buffer))
565 (insert " Article retrieved.\n")
566 (search-forward "\n\n" nil 'move)
567 (delete-region (point) (point-max))
570 (insert-buffer-substring cache-buf)
571 (setq cached (cdr cached)))
572 (kill-buffer cache-buf)))
575 (defun gnus-jog-cache ()
576 "Go through all groups and put the articles into the cache.
579 $ emacs -batch -l ~/.emacs -l gnus -f gnus-jog-cache"
581 (let ((gnus-mark-article-hook nil)
583 (nnmail-spool-file nil)
585 (gnus-use-dribble-file nil)
586 (gnus-novice-user nil)
587 (gnus-large-newsgroup nil))
590 ;; Go through all groups...
591 (gnus-group-mark-buffer)
592 (gnus-group-iterate nil
594 (let (gnus-auto-select-next)
595 (gnus-summary-read-group group nil t)
596 ;; ... and enter the articles into the cache.
597 (when (eq major-mode 'gnus-summary-mode)
598 (gnus-uu-mark-buffer)
599 (gnus-cache-enter-article)
600 (kill-buffer (current-buffer))))))))
602 (defun gnus-cache-read-active (&optional force)
603 "Read the cache active file."
604 (gnus-make-directory gnus-cache-directory)
605 (if (or (not (file-exists-p gnus-cache-active-file))
606 (zerop (nth 7 (file-attributes gnus-cache-active-file)))
608 ;; There is no active file, so we generate one.
609 (gnus-cache-generate-active)
610 ;; We simply read the active file.
612 (gnus-set-work-buffer)
613 (nnheader-insert-file-contents gnus-cache-active-file)
614 (gnus-active-to-gnus-format
615 nil (setq gnus-cache-active-hashtb
617 (count-lines (point-min) (point-max)))))
618 (setq gnus-cache-active-altered nil))))
620 (defun gnus-cache-write-active (&optional force)
621 "Write the active hashtb to the active file."
623 (and gnus-cache-active-hashtb
624 gnus-cache-active-altered))
625 (gnus-write-active-file gnus-cache-active-file gnus-cache-active-hashtb t)
626 ;; Mark the active hashtb as unaltered.
627 (setq gnus-cache-active-altered nil)))
629 (defun gnus-cache-possibly-update-active (group active)
630 "Update active info bounds of GROUP with ACTIVE if necessary.
631 The update is performed if ACTIVE contains a higher or lower bound
633 (let ((lower t) (higher t))
634 (if gnus-cache-active-hashtb
635 (let ((cache-active (gnus-gethash group gnus-cache-active-hashtb)))
637 (unless (< (car active) (car cache-active))
639 (unless (> (cdr active) (cdr cache-active))
641 (gnus-cache-read-active))
643 (gnus-cache-update-active group (car active) t))
645 (gnus-cache-update-active group (cdr active)))))
647 (defun gnus-cache-update-active (group number &optional low)
648 "Update the upper bound of the active info of GROUP to NUMBER.
649 If LOW, update the lower bound instead."
650 (let ((active (gnus-gethash group gnus-cache-active-hashtb)))
652 ;; We just create a new active entry for this group.
653 (gnus-sethash group (cons number number) gnus-cache-active-hashtb)
654 ;; Update the lower or upper bound.
656 (setcar active number)
657 (setcdr active number)))
658 ;; Mark the active hashtb as altered.
659 (setq gnus-cache-active-altered t)))
662 (defun gnus-cache-generate-active (&optional directory)
663 "Generate the cache active file."
665 (let* ((top (null directory))
666 (directory (expand-file-name (or directory gnus-cache-directory)))
667 (files (directory-files directory 'full))
672 (concat "^" (regexp-quote
673 (file-name-as-directory
674 (expand-file-name gnus-cache-directory))))
675 (directory-file-name directory))
676 (nnheader-replace-chars-in-string
677 (substring (directory-file-name directory) (match-end 0))
681 (gnus-message 5 "Generating the cache active file...")
682 (setq gnus-cache-active-hashtb (gnus-make-hashtable 123)))
683 (when (string-match "^\\(nn[^_]+\\)_" group)
684 (setq group (replace-match "\\1:" t nil group)))
685 ;; Separate articles from all other files and directories.
687 (if (string-match "^[0-9]+$" (file-name-nondirectory (car files)))
688 (push (string-to-int (file-name-nondirectory (pop files))) nums)
689 (push (pop files) alphs)))
690 ;; If we have nums, then this is probably a valid group.
691 (when (setq nums (sort nums '<))
692 (gnus-sethash group (cons (car nums) (gnus-last-element nums))
693 gnus-cache-active-hashtb))
694 ;; Go through all the other files.
696 (when (and (file-directory-p (car alphs))
697 (not (string-match "^\\."
698 (file-name-nondirectory (car alphs)))))
699 ;; We descend directories.
700 (gnus-cache-generate-active (car alphs)))
701 (setq alphs (cdr alphs)))
702 ;; Write the new active file.
704 (gnus-cache-write-active t)
705 (gnus-message 5 "Generating the cache active file...done"))))
708 (defun gnus-cache-generate-nov-databases (dir)
709 "Generate NOV files recursively starting in DIR."
710 (interactive (list gnus-cache-directory))
712 (let ((nnml-generate-active-function 'identity))
713 (nnml-generate-nov-databases-1 dir))
716 (defun gnus-cache-move-cache (dir)
717 "Move the cache tree to somewhere else."
718 (interactive "FMove the cache tree to: ")
719 (rename-file gnus-cache-directory dir))
721 (defun gnus-cache-fully-p (&optional group)
722 "Returns non-nil if the cache should be fully used.
723 If GROUP is non-nil, also cater to `gnus-cacheable-groups' and
724 `gnus-uncacheable-groups'."
726 (not (eq gnus-use-cache 'passive))
729 (and (or (not gnus-cacheable-groups)
730 (string-match gnus-cacheable-groups group))
731 (or (not gnus-uncacheable-groups)
732 (not (string-match gnus-uncacheable-groups group)))))))
734 (provide 'gnus-cache)
736 ;;; gnus-cache.el ends here