From 6a7bd7f2282b4dee011e4783d0e278b4ea49e920 Mon Sep 17 00:00:00 2001 From: Mehdi Abaakouk Date: Sun, 20 Apr 2014 17:20:52 +0200 Subject: [PATCH] Allow configure asn cache expiration --- lg.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lg.py b/lg.py index 829b2fd..477e29a 100644 --- a/lg.py +++ b/lg.py @@ -47,6 +47,7 @@ file_handler.setLevel(getattr(logging, app.config["LOG_LEVEL"].upper())) app.logger.addHandler(file_handler) memcache_server = app.config.get("MEMCACHE_SERVER", "127.0.0.1:11211") +memcache_expiration = int(app.config.get("MEMCACHE_EXPIRATION", "1296000")) # 15 days by default mc = memcache.Client([memcache_server]) def get_asn_from_as(n): @@ -378,7 +379,7 @@ def get_as_name(_as): app.logger.info("asn for as %s not found in memcache", _as) name = get_asn_from_as(_as)[-1].replace(" ","\r",1) if name: - mc.set(str("lg_%s" % _as), str(name), 3600) + mc.set(str("lg_%s" % _as), str(name), memcache_expiration) return "AS%s | %s" % (_as, name)