* riece-channel.el: Require 'riece-cache.
authorDaiki Ueno <ueno@unixuser.org>
Sat, 19 Nov 2005 00:30:37 +0000 (00:30 +0000)
committerDaiki Ueno <ueno@unixuser.org>
Sat, 19 Nov 2005 00:30:37 +0000 (00:30 +0000)
(riece-find-channel): Increase priority of given channel name in
riece-channel-cache.
(riece-forget-channel): Remove given channel name from
riece-channel-cache.
(riece-get-channel): Register given channel name in
riece-channel-cache (if it is being added to riece-channel-obarray.)
* riece-server.el (riece-reset-process-buffer): Initialize
riece-channel-cache.
* riece-options.el (riece-channel-cache-max-size): New user
option.
* riece-misc.el (riece-get-channels-on-server): Get channel names
from riece-channel-cache.
* riece-globals.el (riece-channel-cache): New variable.

lisp/ChangeLog
lisp/riece-channel.el
lisp/riece-globals.el
lisp/riece-misc.el
lisp/riece-options.el
lisp/riece-server.el
lisp/riece-user.el

index 044bdd4..a6b0767 100644 (file)
@@ -1,3 +1,20 @@
+2005-11-19  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-channel.el: Require 'riece-cache.
+       (riece-find-channel): Increase priority of given channel name in
+       riece-channel-cache.
+       (riece-forget-channel): Remove given channel name from
+       riece-channel-cache.
+       (riece-get-channel): Register given channel name in
+       riece-channel-cache (if it is being added to riece-channel-obarray.)
+       * riece-server.el (riece-reset-process-buffer): Initialize
+       riece-channel-cache.
+       * riece-options.el (riece-channel-cache-max-size): New user
+       option.
+       * riece-misc.el (riece-get-channels-on-server): Get channel names
+       from riece-channel-cache.
+       * riece-globals.el (riece-channel-cache): New variable.
+
 2005-11-18  Daiki Ueno  <ueno@unixuser.org>
 
        * riece-cache.el: Renamed from riece-lru.el.
 2005-11-18  Daiki Ueno  <ueno@unixuser.org>
 
        * riece-cache.el: Renamed from riece-lru.el.
        (riece-forget-user): Remove given username from riece-user-lru.
        (riece-rename-user): Rename given username in riece-user-lru.
        (riece-get-user): Register given username in riece-user-lru (if
        (riece-forget-user): Remove given username from riece-user-lru.
        (riece-rename-user): Rename given username in riece-user-lru.
        (riece-get-user): Register given username in riece-user-lru (if
-       is being added to riece-user-obarray.)
-
+       it is being added to riece-user-obarray.)
        * riece-server.el: Require 'riece-lru.
        (riece-reset-process-buffer): Initialize riece-user-lru.
        * riece-server.el: Require 'riece-lru.
        (riece-reset-process-buffer): Initialize riece-user-lru.
-
        * riece-options.el (riece-user-lru-max-size): New user option.
        * riece-misc.el: Require 'riece-lru.
        (riece-get-users-on-server): Get usernames from riece-user-lru.
        * riece-options.el (riece-user-lru-max-size): New user option.
        * riece-misc.el: Require 'riece-lru.
        (riece-get-users-on-server): Get usernames from riece-user-lru.
-
        * riece-globals.el (riece-user-lru): New variable.
        * COMPILE (riece-modules): Added riece-lru.
        * riece-globals.el (riece-user-lru): New variable.
        * COMPILE (riece-modules): Added riece-lru.
-
        * riece-lru.el: New file.
 
        * riece-develop.el: New file.
        * riece-lru.el: New file.
 
        * riece-develop.el: New file.
index 2536e5b..454725b 100644 (file)
 (require 'riece-globals)
 (require 'riece-identity)
 (require 'riece-mode)
 (require 'riece-globals)
 (require 'riece-identity)
 (require 'riece-mode)
+(require 'riece-cache)
 
 ;;; Channel object:
 (defun riece-find-channel (name)
   "Get a channel object named NAME from the server buffer."
 
 ;;; Channel object:
 (defun riece-find-channel (name)
   "Get a channel object named NAME from the server buffer."
+  (riece-cache-get riece-channel-cache name)
   (let ((symbol (intern-soft (riece-identity-canonicalize-prefix name)
                             riece-channel-obarray)))
     (if symbol
        (symbol-value symbol))))
 
 (defun riece-forget-channel (name)
   (let ((symbol (intern-soft (riece-identity-canonicalize-prefix name)
                             riece-channel-obarray)))
     (if symbol
        (symbol-value symbol))))
 
 (defun riece-forget-channel (name)
+  (riece-cache-delete riece-channel-cache name)
   (let ((symbol (intern-soft (riece-identity-canonicalize-prefix name)
                             riece-channel-obarray)))
     (when symbol
   (let ((symbol (intern-soft (riece-identity-canonicalize-prefix name)
                             riece-channel-obarray)))
     (when symbol
@@ -55,7 +58,10 @@ respectively."
   (let ((symbol (intern-soft (riece-identity-canonicalize-prefix name)
                             riece-channel-obarray)))
     (if symbol
   (let ((symbol (intern-soft (riece-identity-canonicalize-prefix name)
                             riece-channel-obarray)))
     (if symbol
-       (symbol-value symbol)
+       (progn
+         (riece-cache-get riece-channel-cache name)
+         (symbol-value symbol))
+      (riece-cache-set riece-channel-cache name name)
       (set (intern (riece-identity-canonicalize-prefix name)
                   riece-channel-obarray)
           (riece-make-channel nil nil nil nil nil nil nil)))))
       (set (intern (riece-identity-canonicalize-prefix name)
                   riece-channel-obarray)
           (riece-make-channel nil nil nil nil nil nil nil)))))
index 348e155..670427b 100644 (file)
@@ -131,6 +131,9 @@ Local to the server buffers.")
 (defvar riece-coding-system nil
   "Coding system for process I/O.
 Local to the server buffers.")
 (defvar riece-coding-system nil
   "Coding system for process I/O.
 Local to the server buffers.")
+(defvar riece-channel-cache nil
+  "Cache of channel names.
+Local to the server buffers.")
 (defvar riece-user-cache nil
   "Cache of usernames.
 Local to the server buffers.")
 (defvar riece-user-cache nil
   "Cache of usernames.
 Local to the server buffers.")
index bc06db1..d0575a2 100644 (file)
         (setq identities
               (cons (riece-make-identity (symbol-name channel) server-name)
                     identities)))
         (setq identities
               (cons (riece-make-identity (symbol-name channel) server-name)
                     identities)))
-       riece-channel-obarray)
+       (riece-cache-map-hash-obarray riece-channel-cache))
       identities)))
 
 (defun riece-get-identities-on-server (server-name)
       identities)))
 
 (defun riece-get-identities-on-server (server-name)
index 1a0f37d..0f81403 100644 (file)
@@ -253,6 +253,11 @@ way is to put Riece variables on .emacs or file loaded from there."
   :type 'integer
   :group 'riece-server)
 
   :type 'integer
   :group 'riece-server)
 
+(defcustom riece-channel-cache-max-size 512
+  "Maximum size of cache of channel names."
+  :type 'integer
+  :group 'riece-server)
+
 (defcustom riece-channel-buffer-mode t
   "When non-nil, Riece will display a channel buffer."
   :type 'boolean
 (defcustom riece-channel-buffer-mode t
   "When non-nil, Riece will display a channel buffer."
   :type 'boolean
index 4a64df1..1788e0e 100644 (file)
@@ -272,6 +272,8 @@ the `riece-server-keyword-map' variable."
     (make-local-variable 'riece-channel-obarray)
     (setq riece-channel-obarray (make-vector riece-channel-obarray-size 0))
     (make-local-variable 'riece-coding-system)
     (make-local-variable 'riece-channel-obarray)
     (setq riece-channel-obarray (make-vector riece-channel-obarray-size 0))
     (make-local-variable 'riece-coding-system)
+    (make-local-variable 'riece-channel-cache)
+    (setq riece-channel-cache (riece-make-cache riece-channel-cache-max-size))
     (make-local-variable 'riece-user-cache)
     (setq riece-user-cache (riece-make-cache riece-user-cache-max-size))
     (buffer-disable-undo)
     (make-local-variable 'riece-user-cache)
     (setq riece-user-cache (riece-make-cache riece-user-cache-max-size))
     (buffer-disable-undo)
index 3af38da..8f50548 100644 (file)
@@ -67,7 +67,9 @@ away status, respectively."
   (let ((symbol (intern-soft (riece-identity-canonicalize-prefix name)
                             riece-user-obarray)))
      (if symbol
   (let ((symbol (intern-soft (riece-identity-canonicalize-prefix name)
                             riece-user-obarray)))
      (if symbol
-        (symbol-value symbol)
+        (progn
+          (riece-cache-get riece-user-cache name)
+          (symbol-value symbol))
        (riece-cache-set riece-user-cache name name)
        (set (intern (riece-identity-canonicalize-prefix name)
                    riece-user-obarray)
        (riece-cache-set riece-user-cache name name)
        (set (intern (riece-identity-canonicalize-prefix name)
                    riece-user-obarray)