]> git.e2factory.org Git - e2factory.git/commitdiff
cache: new_cache() is an implementation detail
authorTobias Ulmer <tu@emlix.com>
Wed, 7 Sep 2016 15:32:27 +0000 (17:32 +0200)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:41:18 +0000 (15:41 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/cache.lua

index 170d9ca2375348248fdc1f08e853f6948b15fe6b..4d7e5d67b1404aacc93f640879115f31f12958c9 100644 (file)
@@ -56,6 +56,22 @@ local url = require("url")
 -- @name flags
 -- @field cachable treat a server as cachable?
 
+--- Create a new cache.
+-- @param name Cache name.
+-- @param url base url for this cache, must use file transport
+-- @return a cache table
+local function new_cache(name, url)
+    local c = {}
+    c._name = name
+    c._url = url
+    c._ce = {}
+
+    e2lib.logf(4, "Cache: %s", c._name)
+    e2lib.logf(4, " url: %s", c._url)
+
+    return strict.lock(c)
+end
+
 --- Setup cache from the global server configuration
 -- @param config global config table
 -- @return a cache object
@@ -72,7 +88,7 @@ function cache.setup_cache(config)
     local replace = { u = e2lib.globals.osenv["USER"] }
     local cache_path = e2lib.format_replace(config.cache.path, replace)
     local cache_url = string.format("file://%s", cache_path)
-    local c, re = cache.new_cache("local cache", cache_url)
+    local c, re = new_cache("local cache", cache_url)
     if not c then
         return nil, e:cat(re)
     end
@@ -91,22 +107,6 @@ function cache.setup_cache(config)
     return c, nil
 end
 
---- Create a new cache.
--- @param name Cache name.
--- @param url base url for this cache, must use file transport
--- @return a cache table
-function cache.new_cache(name, url)
-    local c = {}
-    c._name = name
-    c._url = url
-    c._ce = {}
-
-    e2lib.logf(4, "Cache: %s", c._name)
-    e2lib.logf(4, " url: %s", c._url)
-
-    return strict.lock(c)
-end
-
 --- get a sorted list of servers
 -- @param c a cache table
 -- @return table: a list of servers