storeAppendPrintf(entry, "\n");
}
+static void
+free_memcachemode(SquidConfig * config)
+{
+ return;
+}
+
+static void
+parse_memcachemode(SquidConfig * config)
+{
+ char *token = strtok(NULL, w_space);
+ if (!token)
+ self_destruct();
+
+ if (strcmp(token, "always")) {
+ Config.onoff.memory_cache_first = 1;
+ Config.onoff.memory_cache_disk = 1;
+ } else if (strcmp(token, "disk")) {
+ Config.onoff.memory_cache_first = 0;
+ Config.onoff.memory_cache_disk = 1;
+ } else if (strncmp(token, "net", 3) == 0) {
+ Config.onoff.memory_cache_first = 1;
+ Config.onoff.memory_cache_disk = 0;
+ } else if (strncmp(token, "none", 3) == 0) {
+ Config.onoff.memory_cache_first = 0;
+ Config.onoff.memory_cache_disk = 0;
+ } else
+ self_destruct();
+}
+
+static void
+dump_memcachemode(StoreEntry * entry, const char *name, SquidConfig &config)
+{
+ storeAppendPrintf(entry, "%s ", name);
+ if (Config.onoff.memory_cache_first && Config.onoff.memory_cache_disk)
+ storeAppendPrintf(entry, "always");
+ else if (!Config.onoff.memory_cache_first && Config.onoff.memory_cache_disk)
+ storeAppendPrintf(entry, "disk");
+ else if (Config.onoff.memory_cache_first && !Config.onoff.memory_cache_disk)
+ storeAppendPrintf(entry, "network");
+ else if (!Config.onoff.memory_cache_first && !Config.onoff.memory_cache_disk)
+ storeAppendPrintf(entry, "none");
+ storeAppendPrintf(entry, "\n");
+}
+
#include "cf_parser.h"
peer_t
enough to keep larger objects from hoarding cache_mem.
DOC_END
-NAME: memory_cache_first
-TYPE: onoff
-LOC: Config.onoff.memory_cache_first
-DEFAULT: on
+NAME: memory_cache_mode
+TYPE: memcachemode
+LOC: Config
+DEFAULT: always
DOC_START
- Squid normally caches objects retreived from network into memory.
- By setting this to off objects gets released from memory when
- written to disk.
-DOC_END
+ Controls which objects to keep in the memory cache (cache_mem)
-NAME: memory_cache_disk
-TYPE: onoff
-LOC: Config.onoff.memory_cache_disk
-DEFAULT: on
-DOC_START
- Squid normally keeps a copy of cache hit objects in memory as well
- as on disk. By setting this to off cache hits to objects stored on
- disk will not be read back into the memory cache.
+ always Keep most recently fetched objects in memory (default)
+
+ disk Only disk cache hits are kept in memory, which means
+ an object must first be cached on disk and then hit
+ a second time before cached in memory.
+
+ network Only objects fetched from network is kept in memory
DOC_END
NAME: memory_replacement_policy