#NEWLINE# def get( self , key , default = None , version = None ) : #NEWLINE# #INDENT# key = self . make_key ( now , version = version ) #NEWLINE# self . validate_key ( key ) #NEWLINE# db = router . db_for_read ( self . cache_model_class ) #NEWLINE# table = connections [ db ] . ops . quote_name ( self . _table ) #NEWLINE# cursor = connections [ db ] . cursor ( ) #NEWLINE# cursor . execute ( ( 'SELECT cache_key, value, expires FROM %s WHERE cache_key = %%s' % table ) , [ key ] ) #NEWLINE# row = cursor . fetchone ( ) #NEWLINE# if ( row is None ) : #NEWLINE# #INDENT# return default #NEWLINE# #UNINDENT# now = datetime . now ( ) #NEWLINE# if ( row [ 2 ] < now ) : #NEWLINE# #INDENT# db = router . db_for_write ( self . cache_model_class ) #NEWLINE# cursor = connections [ db ] . cursor ( ) #NEWLINE# cursor . execute ( ( 'DELETE FROM %s WHERE cache_key = %%s' % table ) , [ key ] ) #NEWLINE# transaction . commit_unless_managed ( using = db ) #NEWLINE# return default #NEWLINE# #UNINDENT# value = connections [ db ] . ops . process_clob ( row [ 1 ] ) #NEWLINE# return pickle . loads ( base64 . decodestring ( value ) )