Function: pgg-add-passphrase-to-cache

pgg-add-passphrase-to-cache is a byte-compiled function defined in pgg.el.gz.

Signature

(pgg-add-passphrase-to-cache KEY PASSPHRASE &optional NOTRUNCATE)

Documentation

Associate KEY with PASSPHRASE in time-limited passphrase cache.

Truncate the key to 8 trailing characters unless NOTRUNCATE is true
(default false).

Custom variables pgg-cache-passphrase and pgg-passphrase-cache-expiry regulate cache behavior.

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/pgg.el.gz
(defun pgg-add-passphrase-to-cache (key passphrase &optional notruncate)
  "Associate KEY with PASSPHRASE in time-limited passphrase cache.

Truncate the key to 8 trailing characters unless NOTRUNCATE is true
\(default false).

Custom variables `pgg-cache-passphrase' and `pgg-passphrase-cache-expiry'
regulate cache behavior."

  (let* ((key (if notruncate key (pgg-truncate-key-identifier key)))
         (interned-timer-key (intern-soft key pgg-pending-timers))
         (old-timer (symbol-value interned-timer-key))
         ) ;; new-timer
    (when old-timer
        (cancel-timer old-timer)
        (unintern interned-timer-key pgg-pending-timers))
    (set (intern key pgg-passphrase-cache)
         passphrase)
    (set (intern key pgg-pending-timers)
         (run-at-time pgg-passphrase-cache-expiry nil
                      #'pgg-remove-passphrase-from-cache
                      key notruncate))))