<s> """<STR_LIT>""" <EOL> from threading import Lock <EOL> class BaseCache ( object ) : <EOL> def get ( self , key ) : <EOL> raise NotImplemented ( ) <EOL> def set ( self , key , value ) : <EOL> raise NotImplemented ( ) <EOL> def delete ( self , key ) : <EOL> raise NotImplemented ( ) <EOL> def close ( self ) : <EOL> pass <EOL> class DictCache ( BaseCache ) : <EOL> def __init__ ( self , init_dict = None ) : <EOL> self . lock = Lock ( ) <EOL> self . data = init_dict or { } <EOL> def get ( self , key ) : <EOL> return self . data . get ( key , None ) <EOL> def set ( self , key , value ) : <EOL> with self . lock : <EOL> self . data . update ( { key : value } ) <EOL> def delete ( self , key ) : <EOL> with self . lock : <EOL> if key in self . data : <EOL> self . data . pop ( key ) </s>
