#NEWLINE# def _cache_decorator_invalidate( cache , key_length , args ) : #NEWLINE# #INDENT# 'Invalidate a cache key based on function arguments.' #NEWLINE# try : #NEWLINE# #INDENT# cache_key = ' ' . join ( map ( str , args ) ) #NEWLINE# #UNINDENT# except UnicodeEncodeError : #NEWLINE# #INDENT# cache_key = ' ' . join ( map ( unicode , args ) ) #NEWLINE# #UNINDENT# if ( ( len ( cache_key ) + len ( cache . namespace_name ) ) > key_length ) : #NEWLINE# #INDENT# if util . py3k : #NEWLINE# #INDENT# cache_key = cache_key . encode ( 'utf-8' ) #NEWLINE# #UNINDENT# cache_key = sha1 ( cache_key ) . hexdigest ( ) #NEWLINE# #UNINDENT# cache . remove_value ( cache_key )