Function: tramp-get-file-property
tramp-get-file-property is an autoloaded and byte-compiled function
defined in tramp-cache.el.gz.
Signature
(tramp-get-file-property KEY FILE PROPERTY &optional DEFAULT)
Documentation
Get the PROPERTY of FILE from the cache context of KEY.
Return DEFAULT if not set.
Source Code
;; Defined in /usr/src/emacs/lisp/net/tramp-cache.el.gz
;;;###tramp-autoload
(defun tramp-get-file-property (key file property &optional default)
"Get the PROPERTY of FILE from the cache context of KEY.
Return DEFAULT if not set."
(setq key (tramp-file-name-unify key file))
(if (eq key tramp-cache-undefined) default
(let* ((hash (tramp-get-hash-table key))
(cached (and (hash-table-p hash) (gethash property hash)))
(cached-at
(and (consp cached) (format-time-string "%T" (car cached))))
(value default)
cache-used)
(when ;; We take the value only if there is any, and
;; `remote-file-name-inhibit-cache' indicates that it is
;; still valid. Otherwise, DEFAULT is set.
(and (consp cached)
(or (null remote-file-name-inhibit-cache)
(and (integerp remote-file-name-inhibit-cache)
(time-less-p
nil
(time-add (car cached) remote-file-name-inhibit-cache)))
(and (consp remote-file-name-inhibit-cache)
(time-less-p
remote-file-name-inhibit-cache (car cached)))))
(setq value (cdr cached)
cache-used t))
(tramp-message
key 8 "%s %s %s; inhibit: %s; cache used: %s; cached at: %s"
(tramp-file-name-localname key)
property value remote-file-name-inhibit-cache cache-used cached-at)
;; For analysis purposes, count the number of getting this file attribute.
(when (>= tramp-verbose 10)
(let* ((var (intern (concat "tramp-cache-get-count-" property)))
(val (or (and (boundp var) (numberp (symbol-value var))
(symbol-value var))
0)))
(set var (1+ val))))
value)))