VotingApi function takes time to update the database I have added a menu item that calls a function that calls votingapi_set_votes and delete votes. This function works locally fine but when uploaded to the hosting and when i call the function it takes like 5 minutes to update the database with the votingapi_set_votes function.

Menu_item's callback calls a function that contains votingapi_set_votes.
Locally: i call the menu item with the node id as parameter and the a vote is added to the node.
On Hosting: When i call the menu_item i need to wait five minutes or so to see the node vote updated.
I hope this code may work for you Try this code in your theme's js file:

Drupal.behaviors.Your-Theme-Name = {

 attach: function (context, settings) {

//add your class in click function

    jQuery('.view-id-top_users.view-display-id-page .views-field-php .flag-link-toggle').click(function(){

        jQuery(document).ajaxComplete(function() {

         location.reload();

        });

    });

  }

    };