Implementing connect with friend logic and cache