# Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
# Use of this source code is governed by a BSD-style license that can be | |
# found in the LICENSE file. | |
from threading import RLock | |
cache = {} | |
cache_lock = RLock() | |
def get_content(name): | |
with cache_lock: | |
if name in cache: | |
return cache[name] | |
else: | |
return None | |
def set_content(name, content): | |
with cache_lock: | |
if not (name in cache): | |
cache[name] = content |