def patch_cache_lfu(lock_obj):
 import lfu_cache
 import lfu_cache_with_lock
 lfu_lock1lvl = lfu_cache_with_lock.create_cache1lvl(lock_obj)
 lfu_lock2lvl = lfu_cache_with_lock.create_cache2lvl(lock_obj)
 __patch(lfu_cache, 'cache1lvl', lfu_lock1lvl)
 __patch(lfu_cache, 'cache2lvl', lfu_lock2lvl)

def patch_cache_lfu ( lock_obj ) : import lfu_cache import lfu_cache_with_lock lfu_lock1lvl = lfu_cache_with_lock . create_cache1lvl ( lock_obj ) lfu_lock2lvl = lfu_cache_with_lock . create_cache2lvl ( lock_obj ) __patch ( lfu_cache , 'cache1lvl' , lfu_lock1lvl ) __patch ( lfu_cache , 'cache2lvl' , lfu_lock2lvl )
patnches cache mechanizm to be thread safe .