#NEWLINE# def set( self , key , value , expire ) : #NEWLINE# #INDENT# v = self . _dump ( value ) #NEWLINE# result = sa . select ( [ self . table . c . data , self . table . c . id ] , ( self . table . c . key == key ) , for_update = True ) . execute ( ) . fetchone ( ) #NEWLINE# now = time . time ( ) #NEWLINE# if result : #NEWLINE# #INDENT# self . table . update ( ( self . table . c . id == result [ 'id' ] ) ) . execute ( data = v , stored_time = now , expiry_time = expire ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . table . insert ( ) . execute ( key = key , data = v , stored_time = now , expiry_time = expire )