Method code for $command_cache.rehash_cache()

[Turn off line numbering]
  1: var cmd, obj, part, element, info;
  2: 
  3: (> .perms(sender()) <);
  4: (| .purge_cache() |);
  5: if (!.is_general_cache()) {
  6:     // if we are not an official cache, just cache commands we define
  7:     commands = #[];
  8:     for cmd in (.local_commands()) {
  9:         for part in (cmd[2])
 10:             .add_to_cache(part[1], this());
 11:     }
 12:     shortcuts = .shortcuts().to_list();
 13: } else {
 14:     // otherwise cache all defined commands
 15:     if ((info = .all_local_commands())) {
 16:         for element in (info) {
 17:             [obj, element] = element;
 18:             for part in (element)
 19:                 .add_to_cache(part[1], obj);
 20:         }
 21:     }
 22:     shortcuts = .all_shortcuts();
 23: }

// Created 18-Sep-1997 as a part of ColdCore, see: @help Credit

Tlon