Branch: Tag:

2011-07-20

2011-07-20 17:21:08 by Martin Stjernholm <mast@lysator.liu.se>

Fixed cache_expire to correctly expire only the requested cache.

Fixes [bug 5861 (#5861)].

Rev: server/base_server/cache.pike:1.148

1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2009, Roxen IS. - // $Id: cache.pike,v 1.147 2011/05/03 21:20:51 mast Exp $ + // $Id: cache.pike,v 1.148 2011/07/20 17:21:08 mast Exp $      // FIXME: Add argcache, imagecache & protcache   
1409:    // doesn't have to be quick.    foreach (cache_name ? ({cache_name}) : indices (caches), string cn) {    CACHE_WERR ("Emptying cache %O.\n", cn); -  if (CacheManager mgr = caches[cn]) { +  if (CacheManager mgr = caches[cn]) +  if (mapping(mixed:CacheEntry) lm = mgr->lookup[cn]) { +  if (sizeof (mgr->lookup) == 1 || !cache_name) { +  // Only one cache in this manager, or zapping all caches.    mgr->evict (0);    mgr->update_size_limit();    } -  +  else +  foreach (lm;; CacheEntry entry) { +  MORE_CACHE_WERR ("cache_expire: Removing %O\n", entry); +  mgr->remove_entry (cn, entry);    }    } -  +  } + }      void flush_memory_cache (void|string cache_name) {cache_expire (cache_name);}