]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/cache_cf.cc
SourceFormat: enforcement
[thirdparty/squid.git] / src / cache_cf.cc
index a8b3cb72b6fcbe1cb70d722ab42f65eed7275ed0..22a8d9fe90d0cf0116f18aacac332aa84309d2a1 100644 (file)
@@ -625,7 +625,7 @@ configDoConfigure(void)
 
     // we enable runtime PURGE checks if there is at least one PURGE method ACL
     // TODO: replace with a dedicated "purge" ACL option?
-    Config2.onoff.enable_purge = ACLMethodData::ThePurgeCount > 0;
+    Config2.onoff.enable_purge = (ACLMethodData::ThePurgeCount > 0);
 
     Config2.onoff.mangle_request_headers = httpReqHdrManglersConfigured();
 
@@ -1648,7 +1648,7 @@ GetService(const char *proto)
         return 0; /* NEVER REACHED */
     }
     /** Returns either the service port number from /etc/services */
-    if( !isUnsignedNumeric(token, strlen(token)) )
+    if ( !isUnsignedNumeric(token, strlen(token)) )
         port = getservbyname(token, proto);
     if (port != NULL) {
         return ntohs((u_short)port->s_port);
@@ -2771,6 +2771,50 @@ dump_removalpolicy(StoreEntry * entry, const char *name, RemovalPolicySettings *
     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") == 0) {
+        Config.onoff.memory_cache_first = 1;
+        Config.onoff.memory_cache_disk = 1;
+    } else if (strcmp(token, "disk") == 0) {
+        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 (strcmp(token, "never") == 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