uid cache enhancements

Add the uid cache functions thread safe
add function to clear the uid cache when checking for memory leaks