use lru cache for data

master
nathaniel smith 2015-08-01 16:27:08 -07:00
parent 58137b95c2
commit d93cf586a1
1 changed files with 3 additions and 4 deletions

View File

@ -1,3 +1,4 @@
from functools import lru_cache
import json
import os
import random
@ -22,11 +23,9 @@ SITE_NAME = 'tilde.town'
app = Flask('~cgi')
_site_context = None
@lru_cache(maxsize=32)
def site_context():
if not _site_context:
_site_context = get_data()
return _site_context
return get_data()
def slurp(file_path):
contents = None