reset cache
authorvunhat_minh <vunhat_minh@dwango.co.jp>
Fri, 4 Jul 2014 06:47:41 +0000 (15:47 +0900)
committervunhat_minh <vunhat_minh@dwango.co.jp>
Fri, 4 Jul 2014 06:47:41 +0000 (15:47 +0900)
rainbowstream/colorset/solarized.json
rainbowstream/draw.py
rainbowstream/rainbow.py

index 28c001dd4c356d6ecfb4e45e98606907cd7f7064..071db1da2719d25ff22f1cc3573acc9f7a693ab5 100644 (file)
@@ -58,6 +58,6 @@
 
     "CAL" : {
         "days": "term_64",
-        "today": "on_light_green"
+        "today": "light_green"
     }
 }
index 60d0ef624bf2928c6108a70e4508666acf480b23..faf57f93a5ed97d47e8c05f4194c3fe912bc5345 100644 (file)
@@ -28,13 +28,15 @@ def init_cycle():
         for i in c['CYCLE_COLOR']]
     return itertools.cycle(colors_shuffle)
 g['cyc'] = init_cycle()
+g['cache'] = {}
 
 
-def notify_cycle():
+def reset_cycle():
     """
     Notify from rainbow
     """
     g['cyc'] = init_cycle()
+    g['cache'] = {}
 
 
 def order_rainbow(s):
@@ -65,13 +67,11 @@ def Memoize(func):
     """
     Memoize decorator
     """
-    cache = {}
-
     @wraps(func)
     def wrapper(*args):
-        if args not in cache:
-            cache[args] = func(*args)
-        return cache[args]
+        if args not in g['cache']:
+            g['cache'][args] = func(*args)
+        return g['cache'][args]
     return wrapper
 
 
index fe060fb3de0af1a5e411ff50f166877644b7ae41..b7042876ce613fb704b557373acb6e5dd576ed60 100644 (file)
@@ -799,7 +799,7 @@ def theme():
             # Update db and reset colors
             db.theme_update(g['stuff'])
             c['theme'] = g['stuff']
-            notify_cycle()
+            reset_cycle()
             g['decorated_name'] = color_func(
                 c['DECORATED_NAME'])(
                 '[@' + g['original_name'] + ']: ')